DNS: turning names into addresses
Do you memorize all your friends' phone numbers? Usually you look them up by name. The internet is the same. Computers talk in number addresses, but those numbers are hard to memorize. So we use easy names, and DNS turns each name into its number address.
Names are easier to remember than numbers
Earlier we learned computers
find each other by number addresses.
But those numbers
are really hard for people to memorize.
It is just like looking people up by name
instead of memorizing every phone number.
So instead of numbers we use
names that are easy to remember.
We call such a name a domain.
Tap the name and the number address to compare. Which is easier to remember?
A name sticks after one look.
But a number gets muddled fast.
So people want to use names,
while computers need numbers.
The two wishes pull apart.
Then someone has to
turn the name into the number, right?
The one doing that is DNS.
Ask DNS for the name
When you want to go somewhere by name,
your computer first asks DNS.
"What is the number address of this name?"
Then DNS replies,
"The address for that name is this."
It is just like giving a name to directory help
and getting the number back.
This turning of a name into an address
is called a name lookup.
Tap a name to ask DNS. The question goes out, and the number address comes back.
Once the question was sent,
the address came back clear and tidy.
We only knew the name,
yet now the number the computer needs is in hand.
With that number address
the real connection can begin.
But DNS,
where on earth does it keep
all those names and addresses?
DNS is a giant phone book
DNS is a big list that writes down
a great many name-and-address pairs.
Think of a phone book and it is easy.
Names are listed in a row,
with an address beside each one.
When you ask for a name,
DNS searches that list,
finds the matching pair, and pulls out the address.
So we only have to give the name.
Tap a name in the book to look it up. The matching row lights up and shows the number address.
The bigger the list,
the more a search can take a moment.
Real DNS is so huge
that it holds the names of the whole world.
Still, if every question
dug from the start each time, it would be slow.
Looking up a place you visit often
in the book every single time is a hassle.
So there is one clever trick.
Once looked up, it is remembered
A name and address you looked up once
are smart to jot down for a while.
We call that memory a cache.
When you look up the same name again
you need not go all the way to the giant book.
From the note kept right beside you
the address comes out at once.
So from the second time on
the connection is much faster.
Look up the same name twice. The first goes to the book and is slow; the second comes from memory and is fast.
The second lookup
was noticeably faster.
That is because it skipped the book
and took the address straight from memory.
Of course the memory lasts only a while.
An address might change,
so we should not trust it too long.
Still, within a short span
the memory makes the internet faster.
Let's wrap up
Gathered on one line, it is this.
People use names, computers use numbers.
DNS turns a name into a number address.
DNS is a giant book full of pairs,
and what is looked up once is briefly remembered
so next time is faster.
Thanks to that we only have to remember
names instead of numbers.
The tricky numbers we leave to DNS.
Tap the key points in order to review. (name vs number → ask DNS → giant book → once looked up, remembered)
Now you know how a name
turns into a number address.
With the address in hand,
next comes how we find
the way to that address.
Among countless forks,
which way should we go?
Let's follow that route finding
together in the next lesson.