---
title: "DNS and its working mechanism"
subject: "Distributed System"
chapter: 2
key: "semester_7/distributed_system:dns-working"
source: https://www.bctengineer.com/q/semester_7/distributed_system/dns-working
site: BCT Engineering
---

# DNS and its working mechanism

Distributed System · Chapter 2: Distributed Objects and File System

- Asked in: 2075 Asoj, 2+6 marks; 2073 Shrawan, 1+4 marks; 2071 Chaitra, 10 marks (asked 3 times)
- Video: [Lec-81: Domain Name System (DNS) in computer Networks](https://www.youtube.com/watch?v=vhfRArT11jc) — Gate Smashers
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_7/distributed_system/dns-working
- Whole chapter: https://www.bctengineer.com/md/semester_7/distributed_system/chapter-2

## Question

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.)

## 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.

## Answer

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)**

```text
 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.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. Why is naming necessary in a distributed system?
   A. Names make resources faster than direct IP addresses
   B. Names are easy to remember and independent of physical address, so resources can move without users noticing
   C. Names remove the need for any servers
   D. Names guarantee that a resource never moves
   Answer: B. Location-independent names give location transparency and allow sharing. (Key point: Why naming)

2. Why is DNS called a distributed hierarchical database?
   A. One root server stores all records and others copy it
   B. All names are on one flat list replicated everywhere
   C. The name space is a tree split into zones, each managed by its own authoritative servers, with no single server holding everything
   D. Each client keeps the whole database locally
   Answer: C. Zones, delegation and replication spread the data across many servers. (Key point: Distributed hierarchical)

3. For www.tu.edu.np with empty caches, in what order does the local DNS server get referrals?
   A. Root server, then .np server, then edu.np server, then the tu.edu.np authoritative server
   B. tu.edu.np server first, then edu.np, then .np, then root
   C. Root server, then tu.edu.np server directly
   D. Authoritative server of .com, then root, then .np
   Answer: A. Resolution walks down the tree from the root via referrals to the authoritative server. (Key point: Resolution path)

4. What happens after the authoritative server returns the A record?
   A. The root server stores it permanently
   B. The client must ask the authoritative server every time
   C. The record is deleted so it cannot be reused
   D. The local server caches the reply for the TTL and returns it to the client, so later requests are answered from cache
   Answer: D. Caching with TTL reduces load and speeds repeated lookups. (Key point: Caching and TTL)

## Related in Distributed System

- [Stateful/stateless and DNS working](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Astateful-dns-example) — Distributed System, chapter 2
- [Name service and name resolution](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Aname-service-types) — Distributed System, chapter 2
- [Need of naming; Sun NFS](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Anaming-nfs) — Distributed System, chapter 2
- [Autonomous vs distributed system](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Aautonomous-vs-distributed) — Distributed System, chapter 1
- [Models of distributed system](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Amodels-of-ds) — Distributed System, chapter 1
- [True distributed system; middleware organisation](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Atrue-ds-middleware) — Distributed System, chapter 3

## Related in other subjects

- [Need and services of DNS](https://www.bctengineer.com/question.md?key=semester_8%2Finternet_and_intranet%3Adns-need-services) — Internet and Intranet, chapter 3
- [Internet vs Intranet and DNS need](https://www.bctengineer.com/question.md?key=semester_8%2Finternet_and_intranet%3Ainternet-intranet-compare-dns) — Internet and Intranet, chapter 1
- [Types of doors by working mechanism](https://www.bctengineer.com/question.md?key=semester_6%2Fbuilding_technology%3Adoor-types-working) — Building Technology, chapter 6, asked 2×
- [Working mechanism of WDM](https://www.bctengineer.com/question.md?key=semester_5%2Fdata_communication%3Awdm-working) — Data Communication, chapter 6
