How DNS works in depth — root servers, the authoritative chain, caching, EDNS and cookies
If you have already read the DNS basics primer and want the next layer of detail, this article is for you. We zoom in on the parts of the protocol that engineers debug most often: the root and TLD layer, glue records, caching nuances, EDNS(0) options, and DNS cookies.
The root and TLD layer
At the apex of the system sit 13 logical root server identities, named a.root-servers.net. through m.root-servers.net.. Each is operated as an anycast cluster of hundreds of physical instances around the world. The root zone is tiny — a few thousand NS and glue records — and changes rarely, which is exactly what makes it easy to replicate.
The root delegates to TLD operators. com. and net. are run by Verisign and answer for hundreds of millions of names — Verisign's Q4 2024 industry brief reported roughly 370 million total domain registrations across all TLDs. Country-code TLDs (uk., de., tr.) are run by regional registries. New gTLDs (app., dev., xyz.) are run by a mix of large registries and the original applicants.
When a resolver receives a delegation, the parent zone returns NS records plus optional "glue" — A and AAAA records for those nameservers when they live inside the child zone. Without glue, the resolver would have to look up the child's nameserver address from a zone it has not yet learned about.
The caching story
Caching is what keeps DNS cheap. RFC 2308 lays out two flavours:
- Positive caching: any successful answer can be retained until its TTL expires.
- Negative caching:
NXDOMAINandNODATAresponses are retained for the lesser of the SOAminimumfield and the TTL on the SOA itself.
| Cache layer | Where it lives | Typical TTL |
|---|---|---|
| Stub resolver | Operating system / libc | A few seconds to minutes |
| Forwarder | Home router, corporate gateway | Minutes to hours |
| Recursive resolver | ISP or third party such as SecDNS | Honours the authoritative TTL |
| Authoritative server | Origin | N/A (source of truth) |
Caching also affects security. A poisoned cache entry (see How DNS attacks work) can persist for the full TTL, which is why DNSSEC validation is a foundational mitigation — covered in DNSSEC explained.
EDNS(0): extending a 1987 protocol
The original DNS message format caps responses at 512 bytes and has no room for protocol extensions. RFC 6891 introduced EDNS(0), a backwards-compatible mechanism using an OPT pseudo-record to negotiate larger UDP payloads (typically 1232 bytes today) and to carry option codes.
Common EDNS options you will see in real traffic:
- DO bit: tells the server the client wants DNSSEC records.
- NSID (RFC 5001): lets the server identify which anycast instance answered.
- Client Subnet (RFC 7871): a privacy-leaking but performance-boosting option that forwards a truncated client prefix to authoritative servers for geo-aware answers.
You can see EDNS in dig output by inspecting the OPT pseudo-section:
dig +nsid +bufsize=1232 example.com
DNS cookies and on-path defence
DNS cookies (RFC 7873) add a lightweight, symmetric handshake on top of UDP queries. The client sends an 8-byte client cookie, the server replies with a 16-byte server cookie, and both sides reuse the pair on subsequent queries. Forged queries from an attacker who cannot observe the channel will fail the cookie check, which materially reduces the surface for cache poisoning even before DNSSEC is in play.
Cookies do not replace encryption. They are an integrity / anti-spoofing measure for the resolver-to-authoritative leg. End-user privacy still requires DoH or DoT.
Further reading
- Glossary: DNS, DNSSEC, DoH, DoT
- Features: DNSSEC validation, DNS over HTTPS, DNS over TLS
- Learn: DNS basics, DNSSEC explained, How DNS attacks work