4.3.23 · D1Computer Networks

Foundations — DNS — recursive vs iterative query, hierarchy, record types (A, AAAA, CNAME, MX, NS)

1,755 words8 min readBack to topic

Before you can follow recursive vs iterative queries, record types, or the hierarchy, you must own every word and symbol the parent note quietly assumes. This page builds each one from nothing, in an order where each piece rests on the one before it.


1. What is a "name" and what is a "number"?

The picture: imagine a phonebook. The name is "Annie Sharma"; the number is "555-0142". You remember the name; the phone system dials the number.

Figure — DNS — recursive vs iterative query, hierarchy, record types (A, AAAA, CNAME, MX, NS)

Why the topic needs this: DNS's entire reason to exist is this name→number gap. If humans could remember 128-bit numbers, DNS would be pointless. (More on the two number formats in IP Addressing — IPv4 vs IPv6.)


2. The dot, and why we read names right-to-left

Why the topic needs this: the whole hierarchy (root → TLD → domain → host) is literally reading a name right-to-left, one dot at a time.


3. Tree, node, branch, delegation

Figure — DNS — recursive vs iterative query, hierarchy, record types (A, AAAA, CNAME, MX, NS)

4. Client, server, resolver

The picture: the stub resolver is a student who asks the school office one question. The recursive resolver is the office clerk who makes all the phone calls and hands back the final number.

Why the topic needs this: the difference between recursive and iterative queries is entirely about who does the running around — the clerk (recursive resolver) or the person asking (stub). Get these two roles straight and that whole section becomes obvious.


5. Query, referral, authoritative answer

Figure — DNS — recursive vs iterative query, hierarchy, record types (A, AAAA, CNAME, MX, NS)

6. Record, TTL, cache


7. Priority (needed for MX records)

Why the topic needs this: MX records carry these numbers, and the classic mistake is thinking a bigger number means a more important server. It's the opposite.


How these foundations feed the topic

Hostname vs IP address

Labels and the dot

Tree and delegation

Root TLD Authoritative hierarchy

Client server resolver roles

Recursive vs Iterative query

Query referral authoritative answer

Record type value TTL

A AAAA CNAME MX NS records

Cache and TTL

Why DNS scales

Priority number

DNS full lookup flow


Equipment checklist

Cover the right side and test yourself. If any line is shaky, re-read its section above.

A hostname is
the human-readable name of a machine, like www.example.com — text only, for human memory.
An IP address is
the numeric location packets are actually delivered to (IPv4 93.184.216.34, or the longer 128-bit IPv6).
We read a domain name
right-to-left, most-senior (broadest) label first — like country → city → street.
An FQDN is
a name written fully up to the root, marked by a trailing dot: www.example.com..
Delegation means
each level stores only a pointer to the next level, never the whole answer.
A stub resolver is
the dumb DNS client on your laptop that asks one question and waits.
A recursive resolver is
the helper server that does all the running around and caches answers.
A recursive query asks for
the final finished answer ("I'll wait").
An iterative query returns
a referral — the address of the next server to ask.
An authoritative answer is
the final true reply from the server that actually stores the record.
A record has the form
(name, type, value, TTL).
TTL means
how many seconds a cached record stays fresh before re-lookup.
A cache is
short-term memory of recent answers, valid for the TTL, that skips the tree walk.
In MX priority, the preferred server has
the lowest number (tried first).

Back to the main topic: parent note. Related foundations: IP Addressing — IPv4 vs IPv6 · Caching and TTL · HTTP and the Web request lifecycle.