How DNS resolution works in practice
By the end of this module you will be able to:
- Trace a DNS query from stub resolver through recursive resolver to authoritative server
- Name the common DNS record types and explain what each one does
- Explain why TTL and caching cause DNS changes to propagate unevenly across the internet
- Choose between DoT, DoH and DoQ, and say precisely what each one hides and from whom
Real-world incident · October 21, 2016
The Dyn DDoS attack: when the internet lost its phone book
On October 21, 2016, a botnet of compromised Internet of Things (IoT) devices called Mirai launched a massive distributed denial-of-service (DDoS) attack against Dyn, a DNS provider based in Manchester, New Hampshire. Dyn provided managed DNS services for a large portion of the internet's major platforms.
The attack flooded Dyn's infrastructure with tens of millions of DNS lookup requests per second. Their became unable to respond consistently. retried, served cached answers where they still had valid data, or returned resolution failure such as SERVFAIL or timeout when no usable answer could be obtained. is different: it means the queried name does not exist, not that an authoritative server stayed silent under attack.
The platforms themselves were fine. Twitter's servers were running. Netflix's servers were running. The routing was fine. The failure was entirely at the DNS naming layer. Without working name resolution, none of the downstream infrastructure mattered.
Twitter, Netflix, Spotify, Reddit, and PayPal all stopped working at the same time. They are unrelated companies with separate infrastructure. What single point connected them all?
NXDOMAIN and SERVFAIL mean different DNS failures
Each row carries its own next test, and the right one can only be chosen by reading the response code first: a name that does not exist, RCODE 3, never earns the resolver comparison that only RCODE 2 deserves.
Each DNS error name has a precise meaning. NXDOMAIN is not SERVFAIL is not timeout. Read the RCODE first, then run the test that matches the cause.
14.1 The DNS hierarchy: stub, recursive, and authoritative
DNS (Domain Name System) is a distributed, hierarchical, cached naming system. The vocabulary this module uses comes from RFC 9499, published as BCP 219 in March 2024, which obsoletes RFC 8499 and is now the canonical definition of terms such as stub resolver, recursive resolver and authoritative server. If a runbook or a vendor document you inherit still cites 8499, the definitions have moved. Understanding where each role sits is essential for diagnosing DNS failures correctly.
The stub resolver runs on your machine. It is not a full DNS implementation. It takes a question from the application (what is the IP for example.com?), forwards it to a configured recursive resolver, and returns the answer. Most operating systems have a stub resolver built into their networking stack.
The recursive resolver (also called a full-service resolver or caching resolver) does the actual work. It either answers from its cache or walks the DNS hierarchy to find the authoritative answer. ISP resolvers, Google's 8.8.8.8, and Cloudflare's 1.1.1.1 are all recursive resolvers.
Authoritative nameservers hold the final, definitive records for a zone. When you update your domain's A record, you update it at the authoritative server. The recursive resolver fetches the answer from there and caches it for the duration of the TTL (time to live).
“The domain name space is a tree structure.”
RFC 1034 - Section 3.1, Name Space Specifications and Terminology
The hierarchy matters for fault isolation. Root servers direct queries to TLD (top-level domain) servers. TLD servers direct to authoritative servers. Each level can fail independently. When you know which tier failed, you know where to look.
The resolution path for `api.example.com` works like this. The stub resolver asks the recursive resolver. If the recursive resolver has no cache entry, it asks a root server which TLD server handles `.com`. The root server responds. The recursive resolver asks the `.com` TLD server which nameserver handles `example.com`. The TLD server responds. The recursive resolver asks the `example.com` authoritative server for the IP of `api.example.com`. It gets an A record back, caches it for the TTL, and returns it to the stub resolver.
Every one of those steps returned a record, and they were not all the same kind of record. The root and the TLD server answered with delegations rather than addresses, and only the last answer was the A record the application wanted. Reading a resolution trace therefore depends on knowing which record type belongs at which tier.
A cold DNS lookup walks authority, then caches the result
Root and TLD only refer and just the authority answers, making the recursive resolver pay for the whole walk once and then serve the same name from its own cache until the three hundred second TTL runs out.
A cold lookup walks the DNS hierarchy. Each tier refers the resolver to the next; only the authority answers; the recursive resolver caches what it learned.
14.2 DNS record types
DNS records are not just IP address lookups. Each record type has a specific purpose. Confusing them is one of the most common sources of DNS misconfiguration.
A record. Maps a hostname to an IPv4 address. Example: `api.example.com` resolves to `93.184.216.34`.
AAAA record. Maps a hostname to an IPv6 address. The name comes from IPv6 being four times larger than IPv4.
CNAME (canonical name) record. Creates an alias pointing to another hostname. `www.example.com CNAME example.com` means "look up example.com and use that answer for www.example.com." CNAME chains are valid but add resolution steps and latency.
MX (mail exchanger) record. Specifies the mail server for a domain. Points to a hostname (not an IP), with a priority number. Lower priority numbers are tried first.
NS (nameserver) record. Identifies the authoritative nameservers for a zone. These are the servers the TLD delegate queries to.
SOA (start of authority) record. Contains zone metadata: the primary nameserver, the zone administrator's email address, zone serial number, and timing parameters for secondary nameserver synchronisation.
TXT (text) record. Stores arbitrary text. Used for SPF (Sender Policy Framework) email anti-spoofing, DKIM (DomainKeys Identified Mail) public keys, domain ownership verification, and various application tokens.
SVCB and HTTPS records. RFC 9460 defines service binding records that publish connection information before the client opens a transport connection. For web origins, HTTPS records can advertise alternative endpoints, supported application protocols, and parameters that help clients choose HTTP/3 or encrypted client hello paths.
Each of those record types is published once at the authoritative server and then read millions of times somewhere else. What decides how long an A record keeps answering after you have changed it, or how long a stale MX record keeps sending mail to a decommissioned host, is a single number carried alongside the record.
14.3 TTL, caching, and why DNS changes are slow
Every DNS record has a TTL value measured in seconds. When a recursive resolver caches an answer, it keeps it until the TTL expires. This is why a change you made to your DNS record may not be immediately visible to everyone on the internet.
A user whose resolver cached the old A record an hour ago with a 24-hour TTL will continue seeing the old IP for up to 23 more hours. A user whose resolver just looked up the record will get the new one. This is not a bug; it is the design. Caching is what makes DNS scale to billions of queries per day without the authoritative servers handling every single request.
If you are preparing for a DNS migration, reduce the TTL to 300 seconds (five minutes) a day or two before the change. After the change, you can increase it again. This limits how long stale records persist while keeping normal load on the authoritative servers manageable.
Caching also means most answers a client accepts were never spoken by the authoritative server that owns the name. They came out of a resolver's memory, and the client has no way to tell a genuine cached answer from one an attacker injected into that cache, or from one an on-path observer read on its way past. Both halves of that problem have their own mechanism, and they are not the same mechanism.
"DNS is propagating" usually means "some recursive resolvers are still serving the old TTL." There is no central broadcast. Each resolver serves its cached answer until the TTL expires and fetches fresh data.
DNS uses cache first and TCP when UDP is not enough
The TC bit on the UDP reply buys nothing but a repeat, so the same DNS record a cache returns in two milliseconds costs a fresh TCP handshake and ninety milliseconds once the answer will not fit the datagram.
A cache hit answers in milliseconds. A UDP response over 512 bytes (or marked truncated) forces a TCP retry that walks back to the authoritative server.
14.4 DNSSEC: integrity without privacy
DNSSEC (DNS Security Extensions) adds cryptographic signatures to DNS records. It allows resolvers to verify that a response was actually signed by the zone owner and has not been tampered with in transit. DNSSEC prevents cache poisoning attacks where a malicious actor injects false DNS answers.
DNSSEC does not encrypt DNS traffic. Queries and responses are still visible to network observers. What it adds is integrity: you know the answer came from the real zone and has not been modified.
That split leaves half the problem open. A signed answer is a correct answer, but the question that produced it still crosses the network in the clear, so anyone on the path can read every name a device looks up. Closing that half took three separate transports, each of which arrived with a different set of operational consequences.
14.5 DNS goes dark: DoT, DoH and DoQ
Three standards now carry DNS over an encrypted channel, and the difference between them is which existing traffic they resemble. , defined in RFC 7858, puts ordinary DNS messages inside a TLS session on TCP port 853. The port is dedicated to DNS, so a network operator can see that a device is doing encrypted DNS and can permit or block it as a category, without reading the names inside.
, defined in RFC 8484, carries the same messages inside HTTPS requests on port 443. Because it shares a port and a TLS profile with the rest of the web, it is far harder to single out, which is exactly what makes it popular with browser vendors and awkward for network teams that filter by name.
, defined in RFC 9250, runs DNS over QUIC on UDP port 853. It keeps DoT's dedicated-port honesty while taking QUIC's faster connection setup and its freedom from head-of-line blocking, which matters most for resolver-to-authoritative traffic where many queries share one connection.
None of this helps if the client never discovers that an encrypted option exists. Discovery of Designated Resolvers, defined in RFC 9462, is the mechanism that closes that gap: a client asks its configured resolver for designated resolver records, learns the encrypted endpoint that resolver operates, verifies it, and upgrades from plaintext DNS to DoT, DoH or DoQ without a human changing a setting.
The standard friction in enterprise deployment is UDP 853. Many corporate firewalls permit outbound TCP 443 and little else, so DoQ is blocked by default and DoT is blocked wherever the site closes TCP 853 to keep DNS on its own inspecting resolvers. DoH survives because blocking it means blocking the web. The practical result is that the transport a device ends up using is usually decided by the firewall, not by the design document.
“sending DNS queries and getting DNS responses over HTTP”
RFC 8484 - Section 1, Introduction
DoH was standardised in 2018. Its use of port 443 means DNS queries blend into regular HTTPS traffic, making them harder to block or monitor at the network level. That is a privacy gain for the user and a visibility loss for the network operator, and it is why DoH is the transport that survives restrictive egress policies while DoT and DoQ on port 853 do not.
Three ways to encrypt DNS, three different frictions
DoT and DoQ sit on a dedicated port a network can block as a category while DoH shares 443 with ordinary web traffic, but all three lanes end at the same card: the destination address, the server name without Encrypted ClientHello and the resolver's log survive every one of them.
Encrypted DNS moved the trust question rather than removing it: DoT (RFC 7858), DoH (RFC 8484) and DoQ (RFC 9250) hide the query from the path, but the destination address stays visible and so does the server name without ECH.
14.6 What encrypted DNS does not hide
Encryption moved the trust question. It did not remove it. DoT, DoH and DoQ stop an observer on the path between you and your resolver from reading your queries. They give the resolver itself a complete, attributable log of every name you ask for, which is more than the on-path observer had before. Choosing an encrypted resolver is choosing whom to trust with that log.
The traffic that follows the lookup leaks the answer anyway. Once the name has resolved, the connection carries the destination IP address in the clear, and for most sites that address is enough to identify the service. Where a large shared host serves thousands of names from one address, the Server Name Indication field in the TLS ClientHello names the site in plain text at the start of the handshake, so an observer who cannot read your DNS can simply read your connections instead.
Encrypted Client Hello, specified in RFC 9849, is what closes the SNI gap, and it closes it only partially. It requires the client, the DNS records for the origin and the server deployment to support it, and it hides the inner name behind a public one shared by everything on that fronting deployment. Where all three parts are in place, an observer learns that you connected to the fronting service and not which tenant of it you wanted. Where any part is missing, the name is visible as before.
So the honest description of encrypted DNS is narrow and worth stating to anyone who asks for it by name: it protects the confidentiality of your queries against the network between you and the resolver, and it does nothing about the resolver, the destination address, the TLS handshake without ECH, or anything the application does after the connection opens.
Common misconception
“DNS is just a phone book.”
DNS is a distributed, hierarchical, cached system with multiple server roles, transport options (UDP, TCP, TLS, HTTPS, QUIC), security extensions, and record types that do far more than IP lookup. The phone book analogy breaks when you need to explain cache TTLs, recursive versus authoritative roles, DNSSEC validation chains, or why different users see different answers after a DNS change.
Common misconception
“Encrypted DNS makes you anonymous.”
DoT, DoH and DoQ hide your queries from observers on the path to the resolver and move that visibility to the resolver operator, who now holds an attributable log of every name you ask for. The destination IP address of the connection you then open is still in the clear, and without Encrypted Client Hello the SNI field names the site in plain text during the TLS handshake. RFC 9849 closes the SNI gap only where client, DNS and server deployment all support it, and only down to the fronting deployment rather than the individual site. Encrypted DNS is query confidentiality against the local network. It is not anonymity.
Your website works on some ISPs but not others after a DNS change you made two hours ago. What is the most likely cause?
A recursive resolver asks a root server for help resolving api.example.com. What does the root server return?
You set a DNS A record with a TTL of 86400 seconds (24 hours). You then need to change the IP urgently. What happens?
What does DNSSEC add that DNS over TLS (DoT) does not?
A dig query for shop.example.com against your recursive resolver returns NXDOMAIN. The same query sent directly to the example.com authoritative nameserver returns an A record. Which step failed?
A colleague moves their laptop to DNS over HTTPS and says their browsing is now anonymous to their ISP. What is wrong with that claim?
Core distinctions
- DNS resolution is a multi-step hierarchy: stub resolver contacts recursive resolver, which walks root, TLD, and authoritative servers, then caches the answer for the TTL.
- Record types have specific purposes: A for IPv4, AAAA for IPv6, CNAME for aliases, MX for mail, NS for nameserver delegation, TXT for text metadata.
- TTL caching means DNS changes propagate unevenly. Reduce TTL before planned changes; increase it afterwards.
- DNSSEC adds integrity (cryptographic signing). DoT (TCP 853), DoH (HTTPS 443) and DoQ (QUIC on UDP 853) add query confidentiality. They solve different problems and can be used together.
- RFC 9462 lets a client discover its resolver's encrypted endpoint and upgrade automatically. In enterprises, blocked UDP 853 usually decides the transport before any design document does.
- Encrypted DNS moves visibility from the network to the resolver operator. The destination IP is still in the clear, and without Encrypted Client Hello (RFC 9849) so is the SNI. It is query confidentiality, not anonymity.
Standards and sources cited in this module
RFC 1035, Domain Names: Implementation and Specification
Section 3.2, RR Definitions; Section 4, Messages
Defines the DNS message format, record types (A, CNAME, MX, NS, SOA, TXT), and the wire protocol. The record type descriptions in Section 14.2 reference this specification.
RFC 1034, Domain Concepts and Facilities
Section 3.1, Name Space Specifications; Section 5, Resolvers
Defines the DNS name space hierarchy and resolver roles. Quoted in Section 14.1 to distinguish stub, recursive, and authoritative roles.
RFC 8484, DNS Queries over HTTPS (DoH)
Section 1, Introduction
Defines the DNS over HTTPS protocol. Quoted in Section 14.5 for the DoH definition and the port 443 consequence.
RFC 7858, Specification for DNS over Transport Layer Security (TLS)
Section 3, Establishing and Managing DNS-over-TLS Sessions
Defines DoT and its dedicated TCP port 853. Referenced in Section 14.5 for the dedicated-port behaviour that makes DoT visible as a category to network operators.
RFC 9250, DNS over Dedicated QUIC Connections
Section 4, DNS over QUIC Protocol; Section 5, Connection Establishment
Defines DoQ on UDP port 853. Referenced in Section 14.5 for the connection-setup and head-of-line-blocking properties QUIC brings to DNS.
RFC 9462, Discovery of Designated Resolvers
Section 4, Discovery Using Resolver IP Addresses
Defines how a client learns the encrypted endpoint operated by its configured resolver and upgrades to it. Referenced in Section 14.5 for automatic upgrade.
RFC 9499, DNS Terminology (BCP 219)
Throughout
The current terminology reference for DNS roles and concepts, published March 2024 and obsoleting RFC 8499. Anchors the stub, recursive and authoritative definitions in Section 14.1.
RFC 9849, TLS Encrypted Client Hello
Abstract; protocol overview
Defines ECH, the only mechanism that closes the SNI leak left open by encrypted DNS, and only where client, DNS and server deployment all support it. Referenced in Section 14.6.
RFC 9460, Service Binding and Parameter Specification via the DNS
SVCB and HTTPS resource records
Defines SVCB and HTTPS records for publishing connection parameters. Referenced in Section 14.2.
Dyn Blog: DDoS Attack Against Dyn Managed DNS
Published October 22, 2016
Post-incident analysis of the Mirai botnet attack on Dyn's DNS infrastructure. Used as the opening case study to demonstrate the impact of authoritative DNS infrastructure failure.
DNS turns a name into an address, and DoQ has already introduced QUIC as the transport that carries those lookups fastest. The next module takes QUIC seriously in its own right: what UDP gives an application by leaving reliability out, why real-time traffic wants that, and how QUIC rebuilds reliability on top of UDP while removing the head-of-line blocking that TCP cannot avoid.
Module 16 of 45 · Applied stage