How DNS resolution actually works step by step
DNS hierarchy, root nameservers, TLD nameservers, authoritative nameservers, recursive resolver, TTL, DNS caching
DNS: The Internet's Phone Book
DNS translates example.com into an IP like 93.184.216.34. It is a distributed, cached, hierarchical database — not a single server.
The resolution chain
Recursive resolver (usually your ISP or 8.8.8.8) does the hard work. Your OS sends it the domain name and waits for the final answer.
The resolver walks the DNS tree top-down:
- Root nameservers — 13 logical clusters worldwide. They know which nameservers are responsible for each TLD (
.com,.io, etc.). - TLD nameservers — Know which nameserver is authoritative for
example.com. - Authoritative nameserver — The actual source of truth. Returns the
AorAAAArecord with the IP address.
TTL and caching
Every DNS record has a TTL (Time To Live) in seconds. Resolvers cache answers for that duration, so subsequent lookups skip the whole chain. Low TTL = faster propagation after changes, more DNS traffic. High TTL = faster resolution, slower updates.
# Trace the full DNS resolution path
dig +trace example.com
# Check TTL on a record
dig example.com A | grep -i ttlDNS failures are silent and maddening. When a site is down for some users but not others, check TTL and whether stale records are cached at different resolvers.
