// learn Β· networking Β· 12 min

The DNS deep dive.

Beyond the surface explanation. Six animated chapters covering the DNS namespace, recursive versus iterative resolution, cache layers with their TTLs, glue records, NXDOMAIN caching, and what `dig +trace` actually shows you.

DNS deep dive animated tutorial. Covers recursive vs iterative resolution, root and TLD servers, authoritative nameservers, cache layers, TTLs, glue records, NXDOMAIN negative caching, and dig +trace.
// dns deep dive

The DNS surface is "name to IP". The deep version is a hierarchical tree, cache layers everywhere, TTLs that decide what stales when, and a debug tool that bypasses your cache to show the truth.

// before you start
you should know
  • Β·Comfortable with the URL flow lesson (have seen DNS once)
  • Β·Know roughly what an IP address is
  • Β·Helpful: you've run `dig` or `nslookup` at the terminal
by the end you'll

Name the four roles in the chain (client, recursive, root/TLD, authoritative), explain TTLs, identify when glue records matter, and read `dig +trace`.

pace: 12 minutes

dns hierarchy β€” step 1 / 6 Β· the tree
πŸ’» clientalice@laptopπŸ” recursive resolver1.1.1.1 / 8.8.8.8🌐 root13 logical servers (a..m)πŸ› .com TLDa..m .gtld-servers.netπŸ“ authoritativens1.example.comWHAT YOU TYPEWHAT 1.1.1.1 DOESTHE TREE (top β†’ down)

The DNS namespace is a tree

DNS isn't one giant database β€” it's a hierarchical tree. The root is at the top ("."), then top-level domains like .com / .net / .org, then second-level domains like example.com, then any subdomains. Each level is run by different organizations that delegate down. Reading a hostname right to left is reading the tree top to bottom.

// key insight

DNS feels mysterious because every observer sees a different answer β€” your browser's cache, your OS's resolver, your ISP's recursive, the authoritative server. They're probably all right; they're just synced at different points in TTL time. When in doubt: ask the authoritative server directly (dig +trace finds it for you).

// exam-ready Β· dig & friends
$dig example.com
$dig example.com @1.1.1.1
$dig example.com +short
$dig example.com A AAAA MX TXT
$dig +trace example.com
$dig +noall +answer example.com
$dig -x 1.1.1.1
$dig SOA example.com
$dig NS example.com
$nslookup example.com
$host example.com
$getent hosts example.com
$systemd-resolve --flush-caches
$resolvectl statistics
$/etc/resolv.conf
$/etc/nsswitch.conf
// check yourself
4 quick questions
Q1

Who does the actual iterative work when you type a URL?

Q2

You change your website's IP on Friday and want users to see the new address fast. What should you do BEFORE the change?

Q3

Why are GLUE records needed for example.com when its nameservers are ns1.example.com and ns2.example.com?

Q4

`dig example.com` returns the old IP, but `dig +trace example.com` returns the new IP. What's most likely going on?

These aren't graded β€” they're just for active recall, which is what actually makes the lesson stick.

πŸ“ž
// try it now

DNS lookup, in your browser

Resolve any hostname against a public resolver and see the record types, TTLs, and answer chain β€” the same things `dig` would show you locally.

open β†’
// more in networking

keep going β€” these pair well with what you just learned.

see all networking β†’
all lessonsrun dig on this site