Domain Name System (DNS)
1. Definition
The Domain Name System (DNS) is a hierarchical, distributed naming database that translates human-readable domain names into IP addresses (and back). Humans remember www.pyqdeck.com; routers need 104.21.32.7, and DNS is the system that joins the two. It is often called the "phone book of the Internet", uses UDP port 53 for ordinary queries (TCP 53 for zone transfers and large responses), and is defined in RFC 1034/1035.
Early networks kept a single HOSTS.TXT file of all names — impossible to maintain centrally once the Internet grew, so DNS was designed to be distributed (millions of servers share the data), hierarchical (each level is managed by its owner) and cached (answers are reused to cut latency and load).
2. The Domain Namespace
. (root — managed by ICANN, served by 13 root server sets)
┌─────────────────────┼─────────────────────┐
.com .org .in
│ │ │
google wikipedia pyqdeck ← second-level domain
│ │
www.google.com www.pyqdeck.com ← host / subdomain
api.pyqdeck.com
mail.pyqdeck.com
- Top-Level Domains (TLDs) — generic (
.com,.org,.net,.info), sponsored/restricted (.edu,.gov,.mil), country codes (.in,.uk,.jp), and newer ones (.app,.dev,.online). - Second-level domain — the name registered by an organisation (
pyqdeck). - Subdomains / hosts —
www,api,mail, chosen by the owner. - FQDN (Fully Qualified Domain Name) — the complete name ending in the root dot:
www.pyqdeck.com.(up to 253 characters, each label ≤ 63 characters).
3. DNS Servers and Records
| Server | Role |
|---|---|
| Root servers | 13 logical server sets; point to the TLD servers |
| TLD servers | Authoritative for .com, .in, etc.; point to the domain's name servers |
| Authoritative name servers | Hold the actual records for a zone (run by the domain owner/host) |
| Recursive resolver | Does the leg-work on behalf of clients; caches answers (ISP resolver, 8.8.8.8, 1.1.1.1) |
Resource records in a zone file
| Record | Maps | Example |
|---|---|---|
| A | Name → IPv4 address | pyqdeck.com. A 104.21.32.7 |
| AAAA | Name → IPv6 address | pyqdeck.com. AAAA 2606:4700::6815:2007 |
| CNAME | Alias → canonical name | www → pyqdeck.com |
| MX | Mail server for the domain | 10 mail.pyqdeck.com |
| NS | Authoritative name servers | ns1.cloudflare.com |
| TXT | Arbitrary text — SPF/DKIM/DMARC, verification | v=spf1 include:... |
| PTR | Reverse lookup: IP → name | used for troubleshooting/mail reputation |
| SOA | Zone's start of authority: serial, refresh, TTL, admin | — |
| SRV / CAA | Service location / which CAs may issue certificates | — |
4. Name Resolution — Recursive and Iterative
BROWSER RECURSIVE RESOLVER ROOT .com TLD AUTHORITATIVE (pyqdeck)
│ www.pyqdeck.com? │ │ │ │
│ ─────────────────► │ cache miss │ │ │
│ │ ──────────► │ ask .com │ │
│ │ ◄────────── │ │ │
│ │ ────────────────────────► │ ask pyqdeck's NS│
│ │ ◄──────────────────────── │ │
│ │ ────────────────────────────────────────────►│
│ │ ◄───────────────────────────────────────────-│ A = 104.21.32.7
│ ◄───────────────── │ (answer cached for the record's TTL) │
Steps a host actually takes: browser cache → OS cache / hosts file → recursive resolver (which may itself be cached) → root → TLD → authoritative → answer, with caching at every level for the duration of the record's TTL. This is why changing a DNS record can take hours to be seen worldwide ("propagation"), and why lowering TTL before a migration is a standard trick.
5. Other DNS Functions
Reverse lookup (PTR) to find a name from an address · load distribution — several A records for one name, rotated round-robin, or geolocation-aware answers from a CDN · mail routing with MX records · dynamic DNS so a home/mobile device's changing address stays reachable by name · DNSSEC to cryptographically sign records and prevent cache poisoning/DNS spoofing · DoH/DoT (DNS over HTTPS/TLS) to encrypt queries · tools: nslookup, dig, host, ipconfig /displaydns.
6. Advantages and Limitations
| Advantages | Limitations |
|---|---|
| Human-friendly names decouple users from changing IP addresses | If DNS fails, almost everything "breaks" for users (names no longer resolve) |
| Distributed and hierarchical — no single database to maintain | Extra round trip adds latency (mitigated by caching) |
| Caching reduces load and speeds repeat lookups | Caching causes propagation delays after changes |
| Supports load balancing, failover, mail routing, CDNs | Vulnerable to spoofing, cache poisoning, DDoS unless DNSSEC/DoH are used |
| Scalable to billions of names and queries | Centralised governance of the root and TLDs is politically sensitive |
7. Exam Points
- Define DNS and explain why it is needed — 5 marks, almost certain.
- Draw the DNS hierarchy (root, TLD, second-level, subdomain) with an example domain — 5 marks, very frequent.
- Explain name resolution (recursive and iterative) step by step with a diagram — 5-7 marks, very frequent.
- Explain any five DNS record types (A, AAAA, CNAME, MX, NS, TXT) — 5 marks, frequent.
- Which port/protocol does DNS use and why UDP? — 3 marks.
- What is a FQDN? What are the limits on labels and total length? — 3 marks.
- What is DNS caching and why do changes take time to propagate? — 3-5 marks.
- Write short notes on DNSSEC/DNS spoofing — 3 marks.