Track 01 · Lesson 3 of 9How 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
- 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:
- A root server says which servers handle
.com. - The TLD server for
.comsays which servers handleexample.com. - The authoritative server for
example.comgives 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 |
| CNAME | www | example.com. |
| MX | @ | 10 mail.provider.example. |
| TXT | @ | "v=spf1 include:_spf.provider.example ~all" |
| NS | @ | ns1.dnshost.example. |
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 oneBen
Looked it up 20 min before the change
Still the old oneChen
Looked it up 2 min before the change
Still the old one
“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