Names and numbers: DNS
People use names, such as circuit.tako.id. Networks deliver packets only to IP addresses, such as 203.0.113.80. Domain Name System: the system that turns a name such as circuit.tako.id into the IP address it stands for., the Domain Name System, turns the name into the address.
The addresses in this lesson
The addresses here are examples. A real lookup of circuit.tako.id gives a different address.
Why names
A name is easier to remember than four numbers. A name also lets a website move to another server, with another address. If everyone used the address, everyone would have to learn the new one. With a name, the owner changes the address behind the name, and nobody else notices.
DNS works like the contacts on your phone: you tap a name, and the phone dials the number behind it. But your contacts are yours alone, kept on your phone. DNS is one book shared by the whole internet. No single computer has all of it. It is split over many servers, and each server has its own part.
Reading a name
You read a name from right to left, from the most general part to the most exact:
| Part | What it is |
|---|---|
id | The top of the name. .id is the ending for Indonesia. Others are .com, .org, and .uk. |
tako.id | A A name someone has registered, such as tako.id. Its owner decides what names exist under it., a name someone has registered. |
circuit.tako.id | One name inside that domain, chosen by the domain's owner. |
At the very top is the root, the starting point of every name on the internet. Each level knows only the level just under it. The root knows who looks after .id. The .id servers know who looks after tako.id. The tako.id servers know the names inside it.
A lookup, step by step
Your device does not ask all of these servers itself. It asks a A server that looks up names for you. It asks the other DNS servers, and remembers their answers., a server that does the asking for it. Your internet provider usually runs one. Your device learns the address of the resolver when it joins a network. It gets its own address and gateway at the same time. The resolver knows where the root servers are from the start. There is a small, fixed set of them, each copied to many places around the world.
Step through it once. Then pick who already remembers the answer, and step through again.
No message in this step.
- Questions sent so far
- 0
- Laptop remembers
- nothing yet
- Resolver remembers
- nothing yet
Step 1 of 6
You type a name
You type circuit.tako.id. Before asking anyone, the laptop looks in its own memory of recent answers. There is nothing there.
Remembering answers
Four questions for every name would be slow, and the root and .id servers would get the same questions all day. So every answer comes with a number of seconds that it may be remembered for. This number is the answer's Time to live in DNS: how many seconds an answer may be remembered before it must be asked for again., or time to live. The resolver and your laptop each keep the answer until that time runs out. Until then, they answer from memory.
TTL also means the counter on a packet from Routers and the gateway. Both say how long something may live.
The times are examples. A real lookup takes from a few milliseconds to a few hundred.
Clock0:00
Look up circuit.tako.id, then look it up again. After that, wait 5 minutes and try a third time.
The resolver’s memory
| Name | Address | Forgets in |
|---|---|---|
| Empty | ||
Lookups, newest first
None
Remembering has a cost. When a website moves to a new address, resolvers that still remember the old answer keep giving it out until its TTL runs out. So a change to a name can take a while to reach everyone. People often lower a TTL a day before they move a site.
When names stop working
Almost everything you do on the internet starts with a name. So when your device cannot reach its resolver, it can feel as if the whole internet is down. Often it is not, and packets to IP addresses still travel as before. Only the step that turns names into addresses is broken.