9 min
  • DNS
  • UDP

How a name is resolved

There is no list of every domain name anywhere. No machine has one, and no machine could keep one current. DNS answers a question nobody holds the answer to, by asking three servers that each hold one piece of it.

Read a name right to left and you are reading a path down a tree:

text
www.example.com.                ^ the root (the trailing dot, almost never typed)            ^^^ the top-level domain: who runs .com    ^^^^^^^ the domain: delegated by .com to its owner^^^ a name inside that owner's zone

Each dot is a place the tree may have been handed to somebody else. A

zone is one such slice, and every boundary between two of them is where a referral happens.

Loading the DNS Explorer simulation…

Recursive at the top, iterative below

Your machine asks one question and waits. The resolver does the walking: it asks the root, which does not know the answer and says who does; it asks the .com servers, which do not know either and say who does; it asks the

authoritative server, which finally answers.

AskedKnows the answer?What comes back
Root serverNo, and neverA referral to the TLD servers
TLD serverNoA referral to the zone’s servers
AuthoritativeYesThe record, with a TTL

A referral carries addresses as well as names — otherwise resolving ns1.example.com would require resolving ns1.example.com. Those extra records are called glue, and they are what stops the whole system from being circular.

Check yourself
The root server is asked for www.example.com. What does it return?

The transport underneath

A lookup is normally one UDP datagram out and one back — no connection, no handshake, no teardown. That is the same exchange you watched in track 1, seen from the other side:

Loading the Packet Journey simulation…
Predict what happens next
A DNS response is larger than will fit in a UDP datagram. What does the server do?

Key takeaways

  • The namespace is a tree read right to left, cut into zones, and every zone boundary is a delegation to somebody else.
  • Your machine asks one recursive question; the resolver asks as many iterative ones as the walk requires.
  • The root never answers with data. It answers with a referral, which is why thirteen addresses can serve everyone.
  • Glue records carry the addresses of nameservers inside a referral, which is what keeps delegation from being circular.
  • A lookup is normally one UDP datagram each way; an oversized answer sets the truncated flag and is re-asked over TCP.

Take it further