Domain Name System (DNS): Role, Services and Working in Computer Networks
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
2. Nick name
3. Government Issued Id’s
4. Passport number
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 126.96.36.199 (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
- Host name to IP address conversion
- 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).
- 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 : firstname.lastname@example.org, email@example.com etc. This feature is supported by Main Server aliasing.
- 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 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.
- 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 188.8.131.52 (google’s IP address).
- Local DNS maintains a cache memory that maps host name to IP address.
- Local DNS searches www.google.com (host name) in it’s cache memory .
- 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.
- 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).
- 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.
- After receiving response from Root DNS, local DNS sends request to TLD server 1 asking IP address of host name.
- 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.
- After receiving response from TLD server 1, local DNS sends request to Authoritative server 1 asking IP address of host name.
- Authoritative servers stores the IP address of the host name requested, now Authoritative server 1 will return Corresponding IP address (184.108.40.206)of host name(www.google.com) to Local DNS.
- 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,
- Iterative (explained above i.e Local DNS is redirected to TLD and Authoritative server by Root DNS to convert host name to IP address)
- 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:)