Tampere
21 Feb, Wednesday
-0° C

The library of essays of Proakatemia

The world of domain name systems



Kirjoittanut: Juho Helin - tiimistä Ei tiimiä.

Esseen tyyppi: Akateeminen essee / 3 esseepistettä.
Esseen arvioitu lukuaika on 8 minuuttia.

Intro

Have you ever wondered what happens when you write www.google.com on your browser URL bar and press enter. In the following essay i will explain the whole world of DNS network with a simple reoccuring phonebook analogy.

Phone books

Remember how things used to work with phone books. Let’s say you wanted to call a friend who moved to a different place, changed his number and forgot to tell you. You would first go to your local telecom company and pick up a humongous telephone directory book.

Once you finally get it home you would start looking for your friend from the book. You would open up the humongous book and slowly start searching for your friend from it. Eventually you would find him and make a call.

After trying to call the number, there would be no answer but luckily it also contains an address so you decide to go for a visit. This antiquated system could be considered inspiration for the way the modern domain name system works. But nowadays machines do a lot of this manual work for you.

In the following text we will explore how the whole DNS system works. After reading it, you should have a more clear understanding what happens when you type www.facebook.com on your browser URL address bar and press enter.

The phone directory analogy will be revisited again in the essay as a way to make things more clear for the reader.

Basics of IP and Domain

An Internet Protocol, or IP, address is different than a domain name. The IP address is an actual set of numerical instructions. It communicates exact information about the address in a way that is useful to the computer but makes no sense to humans. The domain name functions as a link to the IP address (whatsmyipaddress)

All IP addresses are mapped to a certain domain name. The same way every phone number is tied to a specific person in a telephone directory.

Instead of writing an IP address such as 172.217.12.110 you can instead write www.google.com to access the website.

But if you try typing 172.217.12.110 to your browser address bar it will also open www.google.com. Numbers are how computers communicate with one another, but human beings have come up with a domain name system, so that you do not have to remember the IP numbers.

Name servers

Since domain addresses work exactly like phone numbers on a telephone directory they also need to be stored somewhere.

Every domain is stored in something called a dedicated nameserver. This can be thought of as a telephone directory.

Just as there are massive amounts of phone numbers and telephone directories in the world, there also exists just as many, if not more domains and nameservers.

The same way each city, state and country have their own directories, the exists DNS companies in different parts of the world which have their own nameservers.

These DNS companies communicate with each other to make sure no two identical domains are ever registered.

Every domain is saved in a dedicated nameserver. If I want to find out more information about a specific domain, such as when it was registered and by who, what IP address it connects to, etc. All of this information exists in the nameserver.

The old telephone directories only contain the address, name and number of a person. A nameserver can contain so much more.

We could start printing out massive amounts of books which contain all the domain addresses in the world, but thank god we can store that information digitally.

DNS resolvers

Back in the day, imagine your friend moved somewhere in your country, but you have no idea where. You would need to call up different telephone companies in different cities, and ask for telephone directories searching for him in each one.

Since Domain system works in a similar way, does this mean that you have to go searching through different nameservers all over the world for a specific domain address, luckily the answer is no.

Something exists called a DNS resolvers, they are an entity which the browser communicates with to find an IP address for a specific domain. A request is sent to the DNS resolver to find a certain domains IP address somewhere on the internet.

A DNS resolver could receive a request to find the IP for facebook.com. The resolver gets to work and starts finding out that information. It starts by asking the root nameserver that information.

Root nameserver

This server is managed by a lot of unimaginably giant organizations. They handle every single internet request ever made. They respond to the DNS resolver by letting it know where to find the correct authoritative name server which knows where the domain is located.

Basically they are the guy who knows a guy who knows which nameserver the domain is located in.

Authoritative nameserver

After receiving this information, the resolver contacts something called an authoritative nameserver. They are the guy who knows which nameserver contains the domain. They respond to the resolver with this information.

Final steps

Finally the DNS resolver knows which nameserver the domain is located at so it contacts it. The nameserver responds with the ip address for facebook.com. After receiving this IP address the DNS resolver relays this information back to your browser

The DNS resolver is a never resting best friend which peruses massive amounts of nameservers trying to finding information about a specific domain.

DNS resolver cache

Sometimes when you ask your friend if they remember a phone number for a popular friend they might be able to recite it accurately. This is because the phone number is stored in their memory.

A similar effect can happen when asking a DNS resolver to find an IP address for a very commonly searched domain, such as Facebook.com.

DNS resolvers have something called a cache, which can be thought of as short term memory.

If a specific domain is contacted a lot, it makes sense to store that information close by so that you don’t always have to go searching for it. The cache is memory where DNS resolver can store information about commonly requested domains.

The amount of time which the information remains in memory can be modified with something called TTL, but how this works will be explained further down.

DNS Registrars

In order to register a new domain name, you would need to get your domain to one of these previously mentioned nameservers. These nameservers are managed by companies known as DNS registrars.

DNS registers can be thought of as licensed sellers of domain addresses. They communicate with one another to make sure that they do not register a domain name which has already been claimed. By purchasing your own domain name, you need to buy it through a DNS registrar. They act as a middleman so that you can get your own domain registered.

An example of such registrar is Domain.com or even domains.google (Google also offers these services)

From personal experience i have a podcast called coding and philosophy and i bought a domain codingandphilosophy.com for it. I registered it through an registrar called domain.com. The cost was 15e to have it registered for 2 years. After that time, i can either pay more money, or forfeit the ownership of the domain, as it will be deleted from the nameserver.

These additional expenses are a shame, since back in the day you did not have to pay money to keep your name in the telephone registry. However, they do come with an added benefit. This additional benefit is called DNS records and will be explored in the next chapter.

DNS Records

Back in the day, once a new telephone directory had been published, it would be impossible to change information on it. You would have to wait until the next directory is printed and published.

Let’s say your name was accidently printed out incorrectly. You would have to inform the telephone company, and they would probably say they will fix the problem in the next issue of their telephone directory. Other than that there is nothing you could do but wait.

The modern DNS system erases these types of problems when dealing with domains.

The information about the domain is stored in something called a DNS record. Think of these as different types of modifiable pieces of information which the resolver can look for, depending on what is being requested.

Once you have registered a domain address with your registrar, the registrar should provide a handy dashboard which allows you to modify the records.

When i bought a domain for codingandphilosphy.com, domain.com provided me with a dashboard so i could change my DNS records. I immediately changed something called an A record.

A record

When a DNS resolver get’s a request to find the IP address for codingandphilosophy.com it locates the nameserver where domain exists and then looks for something called an A record

A record is a piece of modifiable data which points to a specifiable IP address.

My friend had a server hosting a website for my codingandphilosophy podcast, and i knew the IP address for his server. I simply needed to make an A record for codingandphilosophy.com which pointed to that IP.

A records for domains can be modified to tell where the website is located at.

Imagine a telephone directory where you are able to modify the phone number attached to your name.

CNAME record

I also have an organization called coding sauna which i own two domains for, netlify.codingsauna.com and codingsauna.fi.

I wanted people who go to codingsauna.fi to be redirected to netlify.codingsauna.com To achieve this, i created something called a CNAME record for my codingsauna.fi domain.

When the resolver goes searching for DNS records of a specific domain and encounters a CNAME record, it points to another domain. Then the DNS resolver does something called a recursive lookup.

This basically means it has to go searching A record from another domain.

Image if you were looking for a friend’s number from the telephone directory and instead found a note saying : “Call the number of John Doe to find me.” This would cause you to search his number instead. This is what happens with recursive lookup, it directs the resolver to start searching from another domain.

Propagation

Whenever you purchase a new domain and it needs to be added to the nameserver, or when you create a DNS record, there needs to be some time for the changes to take effect. This process is called propagation.

This is very aptly named since your changes need to breed to multiple entities across the internet.

The amount of time for changes to take effect can be up to 24 hours, although usually it could last just a couple minutes.

Back in the day the amount of time needed to wait for changes to propagate on telephone directories could wary depending on how often new directories were printed. Althought domain names changes made are not instantaneous, they are still a lot faster

Time to live (TTL)

WHenever you create a new DNS record, you also have the ability to choose TTL for it. This is an acronym for time to live, which means how long does the record stay in cache of the resolver.

If something exists in the memory of resolver, it does not have to look up. This is a double edged sword, since if you set it to be really high it takes far longer for DNS recoed changes to take effect.

Conlusion and how it fits together

Whenever you register a new domain through the DNS registrar. After some time the changes would be propagated in the nameserver and you would now own your domain.

When a person would go to that domain, it would send a request to search for an IP address associated with that domain. This request would be given to the DNS resolver and which would first check if it exists in the cache.

If not , then resolver would start searching from something called a Root nameserver, then moving in to authoritative nameserver until finally reaching the namesever where the domain resides.

From this domain, it would first look for the CNAME record, and see if it needed to go search another domain. If CNAME record doesn’t exsist it would look at the A record to find an IP address.

The resolver would then respond to the browser with that IP address and possibly save it in the cache, depending if TTL has been set.

Everything explained there should now make sense. Armed with this knowledge, go forth and make this world a better place.

References

Whatsmyipaddress. Read on 17.05.2023. https://whatismyipaddress.com/domain-name

AAAAAAAAAAAAAAAAAAH!

Comments
  • Sanni Salokangas

    Sometimes I forget that you’re so old that you actually used phone books once upon a time, best regards, a 21-year old

    17.6.2023
Post a Comment

Add Comment
Loading...

Cancel
Viewing Highlight
Loading...
Highlight
Close