Why do we need a system for managing domain names?

Imagine for a moment what the Internet would be like without a domain name system. It would be just like a phone number. If I had to create an audio commercial for Take Up Code and couldn’t use takeupcode.com, well, I’d probably have to repeat my IP address a lot in order for you to remember it. Do you think you could remember to visit 45.33.99.108? It’s actually less digits than a typical phone number but they’re completely random as far as a customer is concerned. At least phone numbers have similar beginnings for local numbers.

That type of address of 4 numbers separated by dots is called an Internet Protocol address or just IP address for short. Specifically, it’s an IPv4 address. There are newer IPv6 addresses but they’re bigger and much more complicated. I’ll talk about IP addresses in a future episode. For now, just think of them like a phone number. When you press those numbers on a phone, you get connected to whoever you’re trying to reach.

And like the phone number has an easier way to remember the number by using words, so IP addresses also have matching domain names.

When you see a domain name like www.takeupcode.com, what may not be immediately obvious is that it’s divided into a hierarchy that begins on the right with com, then goes to takeupcode, and finally, to www. There can be many more levels but 3-4 is common. The whole point of a hierarchical name like this is to identify a specific computer on the network. Of course, if you already know the network address, then you could just use that directly. But DNS gives you some added benefits beyond just giving you an easier name to remember.

Your browser usually starts by asking your operating system to resolve the name. The operating system needs to be connected to a network somehow and as part of joining that network, there will usually be a computer responsible for resolving names somewhere on the network. This is known as a name resolver or sometimes simply as a DNS server. The name resolver could either be specified directly with its IP address or assigned dynamically when your computer joins the network.

The name resolver will start with the root name servers. You might think this means the com part, but as far as DNS is concerned, there’s an extra dot that comes after the com. This is the root and there are several root servers that can respond to requests. These servers will have no idea where to find www.takeupcode.com but can tell you where to go to get answers for any com names.

So the name resolver gets an address for a com name server and it asks for www.takeupcode.com. The com server also has no knowledge of this but it does have some glue that tells your name resolver where it can find a name server with more information. You see, whenever you register a domain name, you don’t register the name directly for some server IP address where you intend to setup shop. You register the domain and provide a couple name servers. One name server is a backup. These name servers are usually provided by your registrar but you could setup your own if you want.

Your local name resolver now has an address for a name server and asks it for www.takeupcode.com. In this case, it has an answer. And this is called an authoritative answer. If there had been more nesting of names, then the process might sometimes need to continue. At each point, the local name resolver gets closer to finding out the address of the name it’s trying to resolve.

There’s some more details included in the audio so make sure to listen. Or you can also read the full transcript below.

Transcript

I like to listen to talk radio sometimes while driving. Yes, I do listen to other things besides podcasts. Only sometimes, and I usually go back to podcasts because of the commercials. It’s worse than TV. I wouldn’t mind so much if the advertisements were related to the topic. But even more annoying than the commercials has to be a common practice to repeat a phone number 5 times. There’s a good reason for this. It’s hard to remember a bunch of numbers. That’s because they have no relation back to the company. They’re just some numbers. Companies pay lots of money to get phone numbers with a lot of zeros because these are easier to remember.

Another technique is to use the letters printed on most phone keypads to spell out something easier to remember. The only problem is that the numbers 1 and 0 have no letters. So that expensive vanity number with all the zeros actually becomes harder to remember.

But why put so much effort into a phone number? Unless you’re going to have an automated answering machine, somebody has to actually answer a call or it doesn’t matter if customer remembers the number or not. And let’s face it, who wants to just leave a message?

Imagine for a moment what the internet would be like without a domain name system. It would be just like those phone numbers. If I had to create an audio commercial for Take Up Code and couldn’t use takeupcode.com, well, I’d probably have to repeat my IP address a lot more than just 5 times for you to remember it. Do you think you could remember to visit 45.33.99.108? It’s actually less digits than a typical phone number but they’re completely random as far as a customer is concerned. At least phone numbers have similar beginnings for local numbers.

That type of address of 4 numbers separated by dots is called an Internet Protocol address or just IP address for short. Specifically, it’s an IP version 4 address. There are newer IP version 6 addresses but they’re bigger and much more complicated. I’ll talk about IP addresses in a future episode. For now, just think of them like a phone number. When you press those numbers on a phone, you get connected to whoever you’re trying to reach.

And like the phone number has an easier way to remember the number, so IP addresses also have matching domain names.

The letters on a phone keypad though are really just an afterthought. You could end up with a phone number that has no good words that can be spelled. And you’re limited to just one letter for each digit. I remember seeing phone numbers spelled with more letters than needed and this works because the extra numbers just get ignored. It’s not a good system.

The internet was designed to be easier to use than this and the designers knew that they could never be responsible for every computer. Although some very early designs actually did have a single person responsible for mapping names to addresses.

Today, when you see a domain name like www.takeupcode.com, what may not be immediately obvious is that it’s divided into a hierarchy that begins on the right with com, then goes to takeupcode, and finally, to www. There can be many more levels but 3-4 is common.

The whole point of a hierarchical name like this is to identify a specific computer on the network. Of course, if you already know the network address, then you could just use that directly. But DNS gives you some added benefits beyond just giving you an easier name to remember.

It works like this:

You rarely if ever need to resolve a name yourself. You normally type in a name like www.takeupcode.com into your internet browser which assumes you really want the URL http://www.takeupcode.com. For more information about URLs, listen to the previous episode 156. By the way, if you do type this into your browser, my web server will reply with a code instructing your browser to redirect to https://www.takeupcode.com instead. Listen to episode 155 about HTML and HTTP for more information. HTTPS is a more secure version of HTTP.

Your browser usually starts by asking your operating system to resolve the name. The operating system needs to be connected to a network somehow and as part of joining that network, there will usually be a computer responsible for resolving names somewhere on the network. This is known as a name resolver or sometimes simply as a DNS server. The name resolver could either be specified directly with its IP address or assigned dynamically when your computer joins the network.

The name resolver will start with the root name servers. You might think this means the com part, but as far as DNS is concerned, there’s an extra dot that comes after the com. This is the root and there are several root servers that can respond to requests. These servers will have no idea where to find www.takeupcode.com but can tell you where to go to get answers for any com names.

So the name resolver gets an address for a com name server and it asks for www.takeupcode.com. The com server also has no knowledge of this but it does have some glue that tells your name resolver where it can find a name server with more information. You see, whenever you register a domain name, you don’t register the name directly for some server IP address where you intend to setup shop. You register the domain and provide a couple name servers. One name server is a backup. These name servers are usually provided by your registrar but you could setup your own if you want.

Your local name resolver now has an address for a name server and asks it for www.takeupcode.com. In this case, it has an answer. And this is called an authoritative answer. But if there had been more nesting of names, then the process might sometimes need to continue. At each point, the local name resolver gets closer to finding out the address of the name it’s trying to resolve.

I’ll end this episode with two more points. First, if each and every request to resolve a name has to go through this many steps, then not only would it take too long, it would overload the root name servers. A name resolver usually caches any results it finds to be used later. Let’s say that my computer asks a name resolver for the address of www.takeupcode.com and then another computer asks for www.google.com. In each of these requests, the same root server can be used to find the same com servers. So there’s no need to ask the root servers again and the name resolver can skip that step.

And here’s the other point and shows some real power and need for a system like this to resolve names. If you have a small website sitting on a single server somewhere in the world, then any network traffic to that server has to travel all the way there and back. If a customer is nearby, then it can be fast. But if a customer is on the other side of the world, then it can be slow. What if you could have several copies of your website placed conveniently around the world? You don’t want to have to hand out different domain names for these. And you don’t have to. DNS can resolve a single name to different network addresses depending on where the request originates.