← Nitesh Reddy · Today I learned← Prev: Diffie–Hellman
Today I learned · 10 Nov 2026

What really happens when you type a domain name

Not "DNS turns names into IPs". The real path: four caches, one resolver doing all the walking, root → TLD → authoritative referrals, a 12-byte header, TTLs, and the attacks that shaped all of it. Every trace on this page is real output I ran today.

~14 min readnetworkinginfrastructure
TL;DR
Your computer does almost nothing. It asks one recursive resolver (like 1.1.1.1), which walks the tree for you: the root says "ask .lol", .lol says "ask GoDaddy's servers", and GoDaddy gives the answer. Each reply carries a TTL (how long to remember it), so the next lookup is fast.

01 · THE NAME IS A TREERead it right to left

system-design.nitesh.lol really ends with a hidden dot: system-design.nitesh.lol. That last dot is the root. Each label to the left is one level down a tree, and each level can be run by a different organisation. This is called delegation.

DNS name treeRoot at top, then lol, then nitesh, then system-design, each run by a different operator. . (root) lol nitesh system-design com google 13 root servers, 12 operators a/b/c/d.nic.lol ns03/ns04.domaincontrol.com (GoDaddy)
Each box only knows its direct children. Nobody holds the whole tree.

02 · THE CASTFour kinds of players

PlayerWhat it doesIn my lookup
Stub resolverThe tiny DNS client in your OS. Asks one question, waits for a full answer. Does no walking.macOS mDNSResponder
Recursive resolverDoes the real work: walks the tree, follows referrals, caches everything.1.1.1.1 (Cloudflare)
Root / TLD serversOnly give referrals: "I don't know, but these servers handle the next level".g.root-servers.net, d.nic.lol
Authoritative serverHolds the real records for a zone. Its answer is final.ns04.domaincontrol.com

The stub sends a recursive query ("give me the final answer"). The resolver sends iterative queries ("tell me what you know"). That difference is the rd (recursion desired) flag in the packet.

03 · BEFORE ANY PACKETFour caches first

Most lookups never leave your laptop. The order:

#WhereLook at it
1Browser's own DNS cachechrome://net-internals/#dns
2The hosts file (fixed name → IP list)/etc/hosts
3OS cache in the stub resolvermacOS: sudo dscacheutil -flushcache clears it
4Recursive resolver's cache, shared with everyone using itthe Query time in dig

Only when all four miss does the real walk start.

04 · THE WALKFollow the referrals

Click each step. This is exactly what dig +trace system-design.nitesh.lol printed on 10 Nov 2026.

Recursive resolution walkLaptop asks resolver, resolver asks root, TLD, and authoritative servers in turn, then answers the laptop. Laptopstub Resolver1.1.1.1 Rootg.root-servers.net .lol TLDd.nic.lol Authoritativens04.domaincontrol.com


  

The chicken-and-egg problem: glue records

The .lol servers are called a.nic.lol, which is itself inside .lol. To find them you'd need to ask them first. The fix: the root sends their IP addresses along with the referral, in the ADDITIONAL section. These are glue records. Real output from asking a root server directly:

$ dig +norecurse @a.root-servers.net nitesh.lol A
;; flags: qr; QUERY: 1, ANSWER: 0, AUTHORITY: 4, ADDITIONAL: 9
;; AUTHORITY SECTION:
lol.        172800  IN  NS  a.nic.lol.
...
;; ADDITIONAL SECTION:            <- the glue
a.nic.lol.  172800  IN  A     194.169.218.146
a.nic.lol.  172800  IN  AAAA  2001:67c:13cc::1:146

Note ANSWER: 0: the root never answers the question, it only points down. And there is no aa flag, because it is not the authority for nitesh.lol.

And who tells the resolver where root is?

Nobody, at runtime. Every resolver ships with a small file of root server IPs, the root hints (IANA's named.root). For example a.root-servers.net is 198.41.0.4. On start-up the resolver asks one of them for the current list (a priming query). That is the first block of the trace: 13 names, a to m.

The CNAME twist

The final answer was not an IP. It was CNAME system-design-drawn.netlify.app.: "this name is an alias, go look up that one". The resolver then starts a new walk for netlify.app and returns both to my laptop:

system-design.nitesh.lol.        3600 IN CNAME system-design-drawn.netlify.app.
system-design-drawn.netlify.app.  120 IN A     13.215.239.219
system-design-drawn.netlify.app.  120 IN A     52.74.6.109

Two TTLs: GoDaddy says "keep my alias for 3600 s", Netlify says "keep my IPs only 120 s" so it can move traffic between servers quickly.

05 · THE PACKETWhat actually goes on the wire

A normal query is one UDP packet to port 53, and one back. No connection set-up, which is why DNS is fast. The message format is from RFC 1035 (1987) and still in use:

DNS message layout12-byte header with ID, flags and four counts, followed by question, answer, authority and additional sections. ID (16 bits) flags: QR · Opcode · AA · TC · RD · RA · RCODE QDCOUNT ANCOUNT NSCOUNT ARCOUNT ↑ 12-byte header: ID + flags + 4 counts Question Answer Authority Additional
The same format is used for questions and answers. The QR bit says which one it is.
FlagMeaningIn my dig output
qrThis is a responseset
rdRecursion desired: "please walk for me"set (I asked the resolver)
raRecursion available: "I can do that"set by 1.1.1.1
aaAuthoritative answer, from the zone's own servernot set: it came from a cache
tcTruncated: answer too big for UDP, retry over TCPnot set

The 512-byte limit, and how we got past it

RFC 1035 limits a UDP DNS message to 512 bytes. Bigger answers set tc, and the client retries over TCP (slower: needs a connection first). EDNS0 (RFC 6891) adds an OPT record where the client says how big a UDP reply it accepts. My dig showed udp: 1232. That number comes from DNS Flag Day 2020: it is small enough to avoid IP fragmentation on almost every network.

06 · CACHING AND TTLWhy "DNS takes time to update"

Every record has a TTL (time to live) in seconds. A resolver keeps it that long, counting down. From my trace:

RecordTTLSo it is re-asked about every
root NS list518400 (showed 507838 left)6 days
.lol NS1728002 days
nitesh.lol NS, my CNAME36001 hour
Netlify A records1202 minutes

This is why root servers are not overloaded: busy resolvers ask them rarely. It is also the real meaning of "propagation": nothing is pushed anywhere. Old answers just sit in thousands of caches until each TTL hits zero. Tip: lower the TTL a day before you plan to change a record.

"No such name" is cached too. For a missing name the server returns NXDOMAIN plus its SOA record, and the resolver caches the "no" for the SOA's last number (RFC 2308). For nitesh.lol that is 600 s. So if you look up a subdomain before creating it, you may see "not found" for 10 minutes after.

A real bug I hit this week, explained
I pointed system-design.nitesh.lol at a new Netlify site in GoDaddy, and the old page kept showing. DNS was correct: the trace above proves it. The problem was one layer up. Many sites share Netlify's IPs, so Netlify picks the site using the name in the HTTP request (the Host header / TLS SNI). The name was still attached to the old site inside Netlify. DNS only gets you to the building; the building decides which room.

07 · ANYCAST13 names, thousands of servers

There are only 13 root names (an old packet-size limit), but per root-servers.org they are served by 2048 machines run by 12 operators (as of 10 Nov 2026). The trick is anycast: many machines around the world announce the same IP, and internet routing sends you to the nearest one. 1.1.1.1 and 8.8.8.8 work the same way. That is why my query to 1.1.1.1 took only 44 ms from India.

08 · ATTACKSWhy DNS got harder over time

Cache poisoning

Plain DNS over UDP has no signature. A resolver accepts the first reply that matches its question and the 16-bit ID. An attacker can flood fake replies, guessing the ID. In 2008 Dan Kaminsky showed how to keep trying with fresh random sub-names until one guess wins, then take over a whole domain. The fix was to also randomise the source port: now an attacker must guess about 16 bits of ID and about 16 bits of port (RFC 5452).

DNSSEC: signed answers

DNSSEC adds signatures (RRSIG records) to answers. Each parent signs a hash of the child's key (a DS record), forming a chain up to the root's key, which resolvers trust in advance (RFC 4033). A forged answer then fails the check. It proves the answer is genuine, but it is still readable by anyone.

Privacy: encrypted DNS

FixWhat it hidesSpec
DoT (DNS over TLS, port 853)Your questions, from the network pathRFC 7858
DoH (DNS over HTTPS, port 443)Same, and looks like normal web trafficRFC 8484
QNAME minimisationThe resolver tells root only lol, not the full nameRFC 9156

The TLS handshake inside DoT and DoH uses the same Diffie–Hellman key exchange from yesterday's note.

09 · TRY ITCommands to see all this yourself

dig +trace example.com          # the full walk from root
dig example.com                 # run twice, compare "Query time"
dig +norecurse @a.root-servers.net example.com   # a raw referral
dig example.com NS +short       # who is authoritative
dig nosuchname.example.com      # NXDOMAIN + SOA (negative cache)
dig @1.1.1.1 example.com +tcp   # force TCP instead of UDP

SOURCESWhere these facts come from