Whetstone
0day streak

DNS

The first hop of every request, and the slowest thing to change.

8

Questions

4/3/1

Easy / Med / Hard

Your accuracy

DNS turns a name into an address, and it is the first thing that happens in almost every request you will ever draw on a whiteboard.

How a lookup resolves. The client asks a recursive resolver (usually your ISP's or something like 1.1.1.1). If it has no cached answer it walks down: a root server points it at the TLD servers for .com, which point it at the authoritative nameserver for your domain, which returns the record. Each step is cached, which is why the second lookup is nearly free.

Records worth knowing. A maps a name to an IPv4 address, AAAA to IPv6. CNAME aliases one name to another — and it cannot exist at the zone apex, which is why providers invented ALIAS / ANAME records so example.com can point at a load balancer hostname. NS delegates a zone, MX routes mail, TXT carries verification and policy records.

TTL is the whole tradeoff. A record's TTL tells resolvers how long to cache it. A long TTL means fewer lookups and faster average resolution; a short TTL means you can move traffic quickly. Teams planning a migration drop the TTL to a minute days in advance, precisely because the old TTL is already cached everywhere. "DNS propagation" is not propagation at all — it is just waiting for other people's caches to expire.

DNS as a routing tool. GeoDNS returns different addresses by the client's approximate location, and DNS-based failover pulls a sick region out by changing a record. Both are coarse and slow to take effect, because you do not control the caches. Anycast and a load balancer react in seconds; DNS reacts in minutes at best.