SecDNS

How DNS works in depth — root servers, the authoritative chain, caching, EDNS and cookies

A deeper tour of the DNS resolution path covering root and TLD servers, glue records, negative caching, EDNS(0) options and DNS cookies as defined by RFC 7873.

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: NXDOMAIN and NODATA responses are retained for the lesser of the SOA minimum field and the TTL on the SOA itself.
Cache layerWhere it livesTypical TTL
Stub resolverOperating system / libcA few seconds to minutes
ForwarderHome router, corporate gatewayMinutes to hours
Recursive resolverISP or third party such as SecDNSHonours the authoritative TTL
Authoritative serverOriginN/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

Frequently asked questions

How many root servers are there really?

There are 13 logical root server identities (A through M), but each one is operated as an anycast cluster of hundreds of physical instances around the world. ICANN and the root server operators publish current counts at root-servers.org.

What is a glue record and why do I need one?

A glue record is an A or AAAA record served by the parent zone so that a resolver can reach a child zone's authoritative server without a chicken-and-egg lookup. You need glue whenever the nameserver for a domain lives inside that same domain (for example, ns1.example.com being authoritative for example.com).

Does EDNS break anything?

Most modern networks support EDNS(0) without issue, but older middleboxes occasionally strip or truncate large responses, which is why fallback to TCP/53 and message size negotiation still matter. The DNS Flag Day initiative documents the long tail.

Are DNS cookies a privacy feature?

No. DNS cookies (RFC 7873) are an anti-spoofing mechanism that gives the server lightweight proof that a client is who it claims to be. They reduce the surface for off-path cache poisoning but do not encrypt the query or hide it from on-path observers.

What is negative caching?

Negative caching is the practice of remembering NXDOMAIN and NODATA responses for a bounded TTL (RFC 2308). Without it, resolvers would re-ask the authoritative server every time a client typed a typo.