awesome-everything RU
↑ Back to the climb

Networking & Protocols

The resolver walk: referrals, record types, and glue

Crux How a recursive resolver follows referrals from root to authoritative, what the DNS message sections mean, and why missing glue breaks everything.
Your altitude — climbing toward senior
ZeroJuniorMiddleSenior
You are at middle altitude — in the sky
◷ 14 min

A resolver asking for cdn.example.co.uk does not get an answer from the root server. It gets a referral — “ask the .uk TLD.” Then another referral — “ask example.co.uk’s authoritative server.” Only on the third query does it get an actual IP address. Understanding what travels in those referral responses is what separates a developer who can debug DNS from one who just runs dig and hopes.

Iterative vs recursive queries

The resolver’s queries to root, TLD, and authoritative servers are iterative: the RD (Recursion Desired) bit is cleared. Those servers return only what they know, plus a referral — they never chase the tree for the caller. Only the client’s original query to the resolver has RD=1, asking the resolver to do the full walk.

This distinction matters for security. An authoritative server that accepts RD=1 from external clients — an open resolver — can be abused as a DNS-reflection amplifier: an attacker sends spoofed-source queries and the server sends large responses to the victim. Production authoritatives (Route 53, Cloudflare DNS) never recurse for external clients.

DNS message sections

A DNS message has four sections:

SectionPurpose
QuestionThe query name, type (A, MX, …), class (IN)
AnswerRecords that directly answer the question
AuthorityNS records pointing to the next-hop nameserver
AdditionalPre-fetched A/AAAA records for names in Authority

A referral has nothing in Answer, and has Authority + Additional. The AA (Authoritative Answer) bit is set only when the responding server owns the zone — a referral from a TLD server has AA=0.

The referral chain for cdn.example.co.uk

  1. Resolver → root: asks for cdn.example.co.uk. Root has no answer. It returns Authority: ns.nic.uk (NS record for .uk), plus Additional: ns.nic.uk A 193.0.0.1 (glue). No Answer section.
  2. Resolver → .uk TLD: asks same QNAME. TLD returns Authority: ns1.example.co.uk (NS for example.co.uk), plus Additional: ns1.example.co.uk A 198.51.100.4 (glue). Still no Answer.
  3. Resolver → authoritative: asks same QNAME. Authoritative returns Answer: cdn.example.co.uk A 203.0.113.10 TTL=300. AA bit set.
Trace it
1/6

Trace a cold DNS lookup of cdn.example.co.uk from a clean cache.

1
Step 1 of 6
Resolver has nothing cached. First step?
2
Locked
Root responds. What does the resolver receive?
3
Locked
Resolver queries .uk TLD. What does it ask?
4
Locked
TLD responds. What now?
5
Locked
Resolver queries example.co.uk authoritative. What does it receive?
6
Locked
Next identical query within TTL?

Glue records and the circular dependency

When a zone delegates to a nameserver inside its own zone (the NS for example.com is ns1.example.com), the parent zone must include the A record for ns1.example.com as glue in the referral. Without glue, the resolver cannot find the nameserver without first resolving example.com — a chicken-and-egg loop.

Missing glue causes intermittent SERVFAIL or referral loops. Out-of-bailiwick NS records (e.g., ns1.somednsprovider.org) need no glue because the resolver can ask a different zone for their IP.

Common DNS record types
A
IPv4 address
AAAA
IPv6 address
CNAME
alias → another name (never an IP)
MX
mail server hostname + priority
TXT
free text — SPF, DKIM, verification
NS
delegation — nameserver for the zone
SOA
zone authority: serial, refresh, TTL mins
CAA
which CAs may issue certs for this domain
HTTPS/SVCB
advertises ALPN + ECH keys (RFC 9460)

CNAME and the apex rule

A CNAME record points a name to another name: www CNAME example.com. The resolver then looks up the target. CNAME is forbidden at the zone apex (the bare domain like example.com) per RFC 1034, because SOA and NS records must also exist at the apex, and CNAME would override every other record type at that name. CDN-specific ALIAS/ANAME records and the new HTTPS record (RFC 9460) work around this.

Quiz

When a recursive resolver gets a referral from a TLD server, where does next-hop information come from?

Quiz

Why is CNAME forbidden at the zone apex (example.com) per RFC 1034?

UDP, TCP, and EDNS0

DNS defaults to UDP port 53. If a response exceeds the UDP buffer, the server sets the TC (truncation) flag and the resolver retries over TCP port 53. TCP is also required for zone transfers (AXFR/IXFR). A firewall that blocks TCP/53 while allowing UDP/53 silently breaks DNSSEC responses and zone transfers.

EDNS0 (RFC 6891) adds an OPT pseudo-record to negotiate larger UDP buffers (typically 1232 or 4096 bytes) and carry extension options including the DNSSEC OK (DO) bit, ECS (client subnet), and EDNS Cookies. Every modern resolver advertises EDNS0; without it DNSSEC responses are truncated.

Order the steps

Order the steps when a client opens https://shop.example.com from a clean cache:

  1. 1 Browser asks OS resolver for shop.example.com
  2. 2 OS resolver forwards to configured upstream (ISP or 1.1.1.1)
  3. 3 Resolver walks root → .com → example.com authoritative
  4. 4 Resolver returns A record (IP) to browser
  5. 5 Browser performs TCP handshake to that IP
  6. 6 Browser performs TLS handshake on top of TCP
  7. 7 Browser sends HTTPS request and receives the page
Why this works

Stub resolver vs full recursive resolver. Your operating system runs a stub resolver — a thin client that forwards queries to a configured upstream and caches briefly. Linux uses systemd-resolved or nscd; macOS uses mDNSResponder; Windows uses the DNS Client service. The stub does almost no work itself. The full recursive resolver — the one that walks root→TLD→authoritative — lives upstream (your router, ISP, or a public resolver like 1.1.1.1). Browsers often bypass the OS stub entirely: Chrome’s Async DNS Resolver and Firefox’s TRR query DoH directly. Flushing the OS stub cache (sudo systemd-resolve --flush-caches) does not flush the upstream resolver’s cache.

Recall before you leave
  1. 01
    What is the operational difference between an authoritative server and a recursive resolver?
  2. 02
    Why must glue records exist for in-bailiwick nameservers?
  3. 03
    Why does DNS fall back from UDP to TCP for some queries?
Recap

A recursive resolver walks the DNS tree iteratively, collecting referrals at each level. Each referral carries NS records in the Authority section plus glue A/AAAA records in Additional — together they break any circular dependency for in-bailiwick nameservers. The AA (Authoritative Answer) bit is only set when the responding server owns the zone. DNS record types go far beyond A records: CNAME aliases names, MX routes mail, TXT carries SPF/DKIM, NS delegates zones, SOA defines zone authority. CNAME is forbidden at the zone apex because SOA and NS must co-exist there. DNS defaults to UDP; large responses (DNSSEC, zone transfers) fall back to TCP. EDNS0 extends UDP buffers and carries DNSSEC flags.

Connected lessons
appears again in152
Continue the climb ↑TTL, caching, and DNS propagation
shortcuts expand
search
K
prev piece
k
next piece
j
cycle tier
t
this menu
?
sources5
expand
  1. 01
  2. 02
  3. 03
  4. 04
  5. 05

Trademarks belong to their respective owners. Editorial reference only.