Track 01 · Lesson 3 of 9How the web works

Track 01 · How the web works

DNS, the internet’s address book

Lesson 3 of 9· 8 min

DNS turns names people can remember into the numbers computers connect to. Before your browser can send a single byte to shop.example.com, it has to find out which IP address that name means right now.

Look up a name

Then look it up again, wait, and restart the browser

Clock: 0 min
  1. Press “Look it up”. Then press it again.

Your browser’s cache

  • (empty)

The resolver’s cache (shared with its other users)

  • (empty)

Caches all the way down#

Most lookups never leave your computer. The browser keeps recent answers, then the operating system, then the recursive resolver (your internet provider’s, or a public one like 1.1.1.1), which is shared by thousands of people. Only when nobody has a fresh answer does the resolver walk the tree:

  1. A root server says which servers handle .com.
  2. The TLD server for .com says which servers handle example.com.
  3. The authoritative server for example.com gives the actual answer.

Every answer comes with a TTL, time to live: how many seconds everyone may keep it.

Records#

A domain’s zone is a short list of records. Each answers a different question, for a different kind of visitor.

Records and moving servers

Click a record, then move to a new server

The zone for example.com: click a record

A@203.0.113.10
AAAA@2001:db8::10
CNAMEwwwexample.com.
MX@10 mail.provider.example.
TXT@"v=spf1 include:_spf.provider.example ~all"
NS@ns1.dnshost.example.
A: The IPv4 address browsers connect to.

Moving to a new server

You change the A record from 203.0.113.10 to 198.51.100.20. Three visitors looked the site up before the change.

  • Ana

    Looked it up 55 min before the change

    Still the old one
  • Ben

    Looked it up 20 min before the change

    Still the old one
  • Chen

    Looked it up 2 min before the change

    Still the old one
“DNS propagation” is just caches expiring. Nothing travels; each cache keeps the old answer until its TTL runs out. Keep the old server running until then.

“Waiting for DNS to propagate”#

Nothing propagates. When you change a record, every cache that already has the old answer keeps it until its TTL runs out. Before a move, lower the TTL (say to 300 seconds) a day ahead, keep the old server running until the old TTL has passed, then raise it again.

Check yourself

You changed your site’s A record an hour ago and some people still reach the old server. Why?