Script Valley
HTTP & The Web: How It Actually Works
How the Internet Moves DataLesson 1.2

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 resolution hierarchy diagram

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:

  1. Root nameservers — 13 logical clusters worldwide. They know which nameservers are responsible for each TLD (.com, .io, etc.).
  2. TLD nameservers — Know which nameserver is authoritative for example.com.
  3. Authoritative nameserver — The actual source of truth. Returns the A or AAAA record 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 ttl

DNS 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.

Up next

TCP vs UDP: which protocol and why it matters

Sign in to track progress