4. DNS
The picture to keep in your head
Every question below is answered twice: first in your phone's contacts, so you can picture it, then in the system, so you know exactly how it works. Each answer ends with a memory code to lock it in.
The picture to keep in your head
You don't remember your friends' phone numbers. You save them as "Amma", "Ravi", "Pizza place", and your phone turns the name into the number when you tap it. If a number isn't saved, you ask a well-connected friend who knows how to find anyone's number. And when someone changes their number, the people who saved the old one keep calling the old one until they update it.
That's DNS, the Domain Name System. Computers reach each other by IP address (a number like 203.0.113.20). People type names like shop.example.com. DNS is the phone book that turns names into numbers, for the whole internet.
Our running example: the online bookstore from Chapter 3, at shop.example.com. In Chapter 3, step 1 of typing a URL was "Find". This chapter is that step, in full.
| In your phone's contacts | In the system |
|---|---|
| A contact's name ("Ravi") | Domain name (shop.example.com) |
| Their phone number | IP address (203.0.113.20) |
| Your saved contacts | Browser and operating-system DNS cache |
| A well-connected friend who finds numbers for you | Recursive resolver (your ISP's, or 8.8.8.8, 1.1.1.1) |
| A directory that tells you which directory to ask | Root servers |
| The directory for one kind of number | TLD servers (.com, .in, .org) |
| The person's own office, which gives the official number | Authoritative name server |
| "This number is valid until Friday" | TTL (time to live) |
(Addresses like 203.0.113.20 and 198.51.100.7 in this chapter are reserved for documentation examples. They don't belong to any real server.)
Figure: finding a phone number and finding an IP address work the same way. Nobody knows every number, but everyone knows who to ask next.