DNS — recursive vs iterative query, hierarchy, record types (A, AAAA, CNAME, MX, NS)
WHY does DNS exist?
The Hierarchy (WHAT the tree looks like)
The servers, top to bottom:
- Root servers (
.) — 13 logical root server names (a–m), massively replicated via anycast. They know where the TLD servers are. - TLD servers (
.com,.org,.in,.edu…) — know where each domain's authoritative name servers are. - Authoritative name servers — the final word; they actually store the records (A, MX…) for that domain.
- Resolver / recursive resolver — your ISP's (or
8.8.8.8) server that does the legwork for you and caches answers.

Recursive vs Iterative Query (the heart)
HOW a lookup actually flows (www.example.com)
- Stub resolver → recursive resolver: recursive "what is
www.example.com?" - Resolver → root: iterative. Root replies "ask
.comTLD ata.gtld-servers.net." - Resolver → TLD
.com: iterative. TLD replies "askns1.example.com(the authoritative NS)." - Resolver → authoritative: iterative. It replies "A record =
93.184.216.34." - Resolver caches the answer (for the record's TTL) and returns it to your laptop.
Record Types (WHAT is stored)
| Type | Maps | Value | Why it exists |
|---|---|---|---|
| A | name → IPv4 | 93.184.216.34 |
the basic forward lookup |
| AAAA | name → IPv6 | 2606:2800:220:1:248:1893:25c8:1946 |
same, but 128-bit IPv6 ("quad-A" = 4×A) |
| CNAME | name → another name (alias) | target.example.com. |
one canonical host, many aliases; change IP in one place |
| MX | domain → mail server (+priority) | 10 mail.example.com. |
tells senders where email goes; lowest priority number = preferred |
| NS | zone → authoritative name server | ns1.example.com. |
the delegation glue: how the tree links levels |
Common Mistakes (Steel-manned)
Active Recall
Recall Quick self-test (cover the answers)
- Which query type does your laptop send? → Recursive.
- Which step does root delegate to? → TLD server.
- AAAA maps to what? → IPv6.
- Why is iterative used between resolver and root? → keeps big servers cheap (no work on others' behalf).
- What lets DNS scale despite billions of names? → caching + hierarchy/delegation.
Recall Feynman: explain to a 12-year-old
Imagine you want a friend's phone number but you only know their name. You ask the school office (recursive resolver): "find me their number, I'll wait." The office doesn't have it, so it asks the city directory: "which neighborhood?" → "this one." Then asks that neighborhood's manager: "which building?" → "that one." Then the building's front desk gives the actual number. The office writes the number on a sticky note (cache) so next time it answers instantly. The office did all the running around; you only asked once.
Flashcards
What is the difference between a recursive and iterative DNS query?
In a normal web lookup, which query type does the stub resolver send to the recursive resolver?
Which queries are iterative in DNS resolution?
What does a root server actually know?
What does an A record map?
What does an AAAA record map?
What is a CNAME record?
What does an NS record do?
In an MX record, which priority value is preferred?
Why can't a CNAME exist at the zone apex?
Why is caching critical to DNS?
What is an FQDN?
Why is iterative resolution used by root/TLD servers?
Connections
- IP Addressing — IPv4 vs IPv6 (A vs AAAA targets)
- Caching and TTL (why DNS scales)
- HTTP and the Web request lifecycle (DNS precedes the TCP connection)
- Anycast Routing (how 13 root names serve the world)
- SMTP and Email Delivery (MX records in action)
- CDN and Load Balancing (CNAME/ALIAS tricks)
Concept Map
Hinglish (regional understanding)
Intuition Hinglish mein samjho
DNS ko samajh lo internet ka phonebook. Tum naam yaad rakhte ho (google.com) lekin computer ko number (IP address) chahiye hota hai. DNS yeh translation karta hai. Ek hi badi file mein sab kuch store karna impossible hai, isliye namespace ko ek tree mein tod diya gaya hai — Root, fir TLD (.com, .in), fir authoritative server jo actual records rakhta hai. Har level sirf agle level ka pata jaanta hai, poora system koi ek machine nahi jaanti — yahi delegation hai.
Ab recursive vs iterative ka funda. Tumhara laptop ek recursive query bhejta hai apne resolver ko: "bhai final answer la ke do, mujhe steps se matlab nahi." Resolver phir iterative queries karta hai — root se poochta hai, root bolta hai "TLD se poocho", TLD bolta hai "authoritative se poocho", aur finally IP mil jaata hai. Bade servers (root/TLD) sirf point karte hain, kaam nahi karte — isliye woh scale kar paate hain. Resolver answer ko cache kar leta hai (TTL tak), taaki agli baar turant de de.
Record types yaad rakho: A = IPv4 address, AAAA = IPv6 (4 'A' = 128 bit), CNAME = alias (ek naam doosre naam ko point karta hai), MX = mail server (lowest number wala pehle try hota hai — yeh ulta lagta hai par yahi rule hai), NS = delegation, kaunsa authoritative server zone ko handle karta hai.
Do common galtiyan: (1) "iterative matlab client loop karta hai" — galat, resolver loop karta hai. (2) "MX ka lower number kam important" — galat, lower number sabse pehle preferred hota hai. In dono ko exam mein zaroor pakdo.