Skip to content

How DNS Works: Who Turns a Name Into an Address?

How does your browser turn a name into an address?

What the video says

Names, not numbers

You type a name, press enter, and a page appears. But the network cannot find a name. It only delivers to numeric addresses. So who turned that name into a number, in milliseconds?

One file for everyone

Once, the answer was one shared file. A single office kept the list of every host, and every computer downloaded a copy. As the network grew, every change had to wait for that office, and sending out copies ate more and more bandwidth. So in November 1983, Paul Mockapetris published a new design: the Domain Name System.

A tree of names

Picture a library with no master catalog. DNS is a tree of names, and you read a name from the right. First the root. Then dot-com. Then example dot com. No level holds the whole list. Each one only knows who is in charge of the next.

One question, 3 stops

So your device does not go searching. It hands the question to one helper, the recursive resolver, like a slip passed to a runner at the front desk. The runner does the legwork.

The runner starts at the root. The root does not know the address, but it knows who runs dot-com, and points there. The dot-com servers do not know it either, but they point to the name's own authoritative server. That one knows. It writes the number on the slip, and the runner carries it back. 3 stops, 1 answer.

Remembered for a while

The answer comes with a time to live, counted in seconds. Until it runs out, the resolver keeps a copy, pinned up by the desk. So when the next visitor asks for the same name, the answer is already there. No trip at all.

Why not one big list?

Why not something simpler? One giant file that everyone copies is always out of date, and one office is the bottleneck. One giant central server is a single point of failure, and it is far away from most people.

Try it: dig

You can watch it yourself. Run dig example dot com. The answer section shows the address, and beside it a number of seconds counting down: the time to live. And the root? 13 root name servers, lettered A to M, run by 12 organizations, as 2046 instances on the day this was made.

So nobody knows every name. Everyone knows who to ask next, and remembers the answer for a while.

Subscribe for the next one. Next time: Docker. What is actually inside of a container?

Sources

Every fact in the video was checked against these when it was made.

Your address is used only for this newsletter. Unsubscribe in one click.