Domain Name System (DNS): Role, Services and Working in Computer Networks

Abhisek Samantaray
5 min readApr 9, 2022
Photo by İsmail Enes Ayhan on Unsplash

Domain Name System(DNS) is responsible for converting host name to IP Address.

First, Let’s try to understand the basic concept of networking and then try to understand DNS.

If you want to identify a person then we can identify by their
1. Name
2. Nick name
3. Government Issued Id’s
4. Passport number

Similarly if we want to identify a end device(host/computer/server , etc..) then we can identify by their
1. IP Address
2. Host name

But why do we need DNS ?

Suppose If you want to go to Google search page , you type www.google.com (Google’s host name) in the browser instead of typing 216.58.207.24 (Google’s IP Address)
Both leads to Google search page.

As a user we mostly use host names in day to day life as its easy to remember as compared to IP address.
But In networking, Routers always need IP address to communicate in between end devices(PC,laptops,Smartphones,etc..) and servers.
So DNS is responsible for conversion of host name to IP address
and then TCP/IP stack or OSI model sends packets to routers for further communication using client-server architecture.

Services of DNS

  1. Host name to IP address conversion
  2. Host Aliasing : It means Routing many host names to one IP address.
    Example : If you mistakenly write the wrong host name like www.facbook.com / www.gogle.com (alias name / nick name)then also Facebook/Google opens this because of host aliasing (providing many names).
  3. Mail Server aliasing : It Provides the mail service on top of that particular web service.
    If you are using a domain name example.com , then you can also create different mail id’s for example : jhon@example.com, tim@example.com etc. This feature is supported by Main Server aliasing.
  4. Load Distribution : There may be many servers of organisation and companies around the globe, to which server my request will be sent this will be decided by DNS. This is called load distribution.

DNS Architecture

DNS follows Hierarchical & Distributed Architecture. In each level there are many servers that takes care of specific tasks and operations.

  • Root DNS is 1st level of Hierarchy, and there are 13 Root DNS servers across the globe. It stores the information about various TLD Servers.
  • Top Level Domain (TLD) servers maintains information about generic domains that ends with .edu, .net, .com, .org, etc and country domains that ends with .us, .uk and .in and etc.
  • Authoritative DNS servers are used for getting correct domain which contains the numerical IP address of the website being sought.
  • Local DNS servers are usually located on the network to which your device is connected. Functionality of Local DNS is discussed in working of DNS section.

Functionality of this Architecture (Root DNS, Top level Domain(TLD) , Authoritative DNS and Local DNS) is to resolve DNS Queries .

Working of DNS

Now let’s try to understand role of DNS and it’s working.

  1. When you enter www.google.com on browser, your device sends request to local DNS for converting www.google.com(google’s host name) to 216.58.207.24 (google’s IP address).
  2. Local DNS maintains a cache memory that maps host name to IP address.
  3. Local DNS searches www.google.com (host name) in it’s cache memory .
  4. Case 1: If host name is present in cache memory, then Local DNS returns its corresponding IP address to device and after receiving response from Local DNS, Communication proceeds further according to client-server architecture.
  5. Case 2: If host name is not present in cache memory, then local DNS sends request to Root DNS asking IP address of host name (www.google.com).
  6. As Root DNS server stores information of various TLD servers. Now Root DNS server will search TLD server which has information of all .com (generic domain name of host name) from it’s database and return the information of TLD server 1 to Local DNS.
  7. After receiving response from Root DNS, local DNS sends request to TLD server 1 asking IP address of host name.
  8. TLD server stores information of many Authoritative servers and now will check for domain name of host name from it’s database and return the information of Authoritative server 1 which is in-charge for google.com domain.
  9. After receiving response from TLD server 1, local DNS sends request to Authoritative server 1 asking IP address of host name.
  10. Authoritative servers stores the IP address of the host name requested, now Authoritative server 1 will return Corresponding IP address (216.58.207.24)of host name(www.google.com) to Local DNS.
  11. Now after receiving IP address from Authoritative server 1, Local DNS first updates the IP address of host name (www.google.com) in it’s cache memory for faster communication in future and then sends IP address to device. then communication continues further according to client-server architecture.

There is two ways of Implementing DNS working,

  1. Iterative (explained above i.e Local DNS is redirected to TLD and Authoritative server by Root DNS to convert host name to IP address)
  2. Recursive (explained below i.e Here Root DNS directly returns IP address to Local DNS instead of redirecting to other servers)

In Recursive implementation, First 5 steps are same as Iterative implementation.

From Step 6 : Instead of redirecting Local DNS to TLD server 1, root server send request to TLD server 1, and TLD server 1 requests to Authoritative server 1 for IP address after receiving IP address from Authoritative server 1 it returns the IP address to root server and then root server sends the IP address to Local DNS.

After receiving the IP address from root DNS , Local DNS updates the cache memory as mentioned above and then send the IP address to device for further communication.

This process looks quite long and tedious process but still this is done within few milliseconds for a web page to render after we hit enter on our keyboard.

That’s it the role, services and working of DNS in Computer networks!!!

Feel free to like, comment or share this article if it was helpful:)

--

--