Domain Naming Service

Anirudh Rajmohan
4 min readMay 18, 2020

--

DNS is the DNA of the internet.

Note: This article is Part I of a three part series explaining how data flows as packets of information on the internet.

Imagine a situation where you wish to call your friend. It is not necessary that you remember the phone number of your friend. And it also not necessary that you call your friend frequently enough to remember the phone number.

All you do is lookup the contact list stored on your own mobile device to find the desired number to dial. In case you do not have the phone number, you lookup your local telephone directory services such as White Pages to find the desired unique phone number based associated with your friend’s name and personal information.

Similarly, all websites on the internet are hosted on commercial grade computers called servers. When you try to access a website from your browser, you are basically trying to establish a communication with the relevant server hosting that website.

Just as in the case of your friend having a unique phone number, all servers(and in extension, all devices) connected to the internet have a unique IP address. 192.168.26.1 is an example of an IP address.

Once again, similar to the case of you not having to remember your friend’s phone number but knowing just his/her name, you need not remember the IP address of the server that hosts the website. It is sufficient for you to remember a human readable name of the website you wish to access. This human readable(and memorable) part of a website name is called as domain.

www.amazon.com is the name of a domain.

Just as White pages/Yellow pages exists as a service for telephone directory, DNS(Domain Naming Service) is the equivalent IP address directory that will do the desired lookup of the IP address to connect to in order for a webpage/website to load.

DNS is a essentially a service that runs in the background and is designed to run so quickly that you hardly notice the vast amount of processing that takes place in order for you webpage to load when you login to a website in a browser.

How does DNS work?

It all starts with you first entering the website/domain name in your browser. Let’s assume www.amazon.com for our example.

DNS as a service is kicked off when you enter a domain name into the browser

A recursive resolver, which is the main working horse of the entire DNS process then tries to look up the corresponding IP address.

  1. The recursive resolver first starts with the local cache stored by the browser or OS. If the browser or OS already have the mapping of the domain name and IP address(technically called dnscache) stored locally, then the use that IP address right away.
  2. In case the mapping does not exist locally in the browser/OS, the recursive cursor then connects to a Root Server. The root servers are setup all over the world and contain information about server IP addresses. In case the desired IP address is not found, the root servers redirect the recursive to the TLD servers.

The last portion/prefix of a domain name(.com) is called as Top-Level Domain(TLD). “.com”, “.org” , “.gov”, “.edu” etc. are examples of TLDs.

3. The TLD server contains enough information about IP addresses that belong to that specific TLD. The TLD servers do not store the direct IP address mapping to that domain but can redirect to the exact Name Server that contains the exact IP address corresponding to the browser.

The domain’s Name Servers contain all information of mappings between domains ending with the corresponding TLDs(.com, .gov etc) and their corresponding IP addresses.

A typical DNS workflow to connect to Amazon’s web server with an associated IP address.

You can learn better about DNS by watching this YouTube video.

Why is DNS important?

Imagine a situation where you do not have a contact list stored on your own device as well as no public listing of phone numbers available to you to be able to contact someone. You would be forced to remember the phone numbers of every one you ever wished to contact.

Similarly, DNS is that invisible backend service that not just makes it convenient to remember human readable domain names(amazon.com is more memorable than 10.128.1.1).

Behind the scenes, DNS utilizes port number 53 as part of its operations. The whole service is designed to run extremely fast — so fast that you would not even notice that the entire DNS operation would have run by the time you hit the website within your browser and the webpage(Amazon in this example) loads before you blink your eye.

There are many domain name registries such as GoDaddy which let you register unique human readable website names so that anyone who wishes to access your website will be redirected to the IP address of your web server by these registries.

AWS offers its own DNS service which it likes to call as Route 53.

Fun Fact: Registering unique domain names is a business of owning intellectual property by itself. People usually register unique domain names for themselves for cheap and resell them to people/organizations that actually need them at a higher price. A fan of the Avengers movie registered the domain avengersendgame.com based on a hunch from the earlier Avengers infinity war movie and was reportedly paid a huge amount to sell the domain name.

--

--