Skip to main content

DNS and its working mechanism

Short answer

DNS is a distributed hierarchical database mapping domain names to IP addresses, split into zones managed by authoritative servers with root, TLD, and local resolvers. Resolution asks servers iteratively or recursively, then caches the reply for the TTL; features include delegation, replication, caching, and scalability.

What is DNS (Domain Name Service)? Explain the DNS working mechanism with features and suitable example. (Why is naming necessary in distributed system? Justify that DNS is a distributed hierarchical database system.)

The Domain Name System (DNS) is a distributed, hierarchical naming service of the Internet that maps human friendly domain names (www.tu.edu.np) to IP addresses and other attributes (mail servers, aliases).

Why naming is needed: names are easy to remember, are independent of the physical address, allow a resource to move without users noticing (location transparency), and let resources be shared and found by many users.

Distributed and hierarchical: the name space is a tree. The root has top-level domains (com, org, edu, np), below them are second-level domains (edu.np), then organisations (tu.edu.np) and hosts. No single server holds the whole database. The tree is split into zones, each managed by one organisation with its own authoritative servers. Delegation passes authority downwards, and replication of each zone (primary and secondary servers) gives fault tolerance. This is why DNS is a distributed hierarchical database.

Name servers

  • Root servers: know the addresses of the top-level domain servers.
  • TLD servers: know the authoritative servers of each second-level domain.
  • Authoritative servers: hold the actual records of a zone (A, AAAA, MX, NS, CNAME, PTR).
  • Local (resolver) server: run by the ISP or organisation, accepts the client's request and does the lookup, with a cache.

Working mechanism (name resolution)

 Client -> Local DNS -> Root -> .np TLD -> edu.np -> tu.edu.np
   ^          |  <----- referrals / answers ------|
   +----------+  answer IP, cached with TTL
  1. The application calls the resolver to find www.tu.edu.np.
  2. The resolver checks its cache; if present it returns the answer.
  3. Otherwise it asks the local DNS server (recursive query).
  4. The local server asks a root server, which refers it to the .np server.
  5. The .np server refers it to the edu.np server, which refers it to the tu.edu.np authoritative server.
  6. The authoritative server returns the A record (IP address).
  7. The local server caches the reply for the TTL and returns it to the client, which connects to the IP.

Resolution methods: iterative (the server returns the next server to ask, the resolver continues) and recursive (the server does the whole lookup for the client). Multicast and non-recursive server-controlled navigation are other variants.

Features: hierarchical naming, distribution of administration, replication, caching with TTL, scalability, and support for many record types.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Distributed System chapter 2 questions →