When we had learnt about the basics of How does the web work, we had come across DNS servers there. With a basic understanding on how these DNS servers actually serve the purpose, we moved on. But here in this article, we will be exploring more on ‘How does DNS servers work?’.
What we already know is, like every system on the internet, a web server too owns a unique identification in the form of an IP address. This IP is actually mapped to the domain name on the DNS server (Domain Name System) maintained with the ISP (Internet Service Provider), which means that if I hit some URL such as jcombat.com, the domain name (jcombat.com) is first resolved into a particular IP (pointing to the server), based on the mapping present on the DNS server. Once the browser receives the IP address of the web server from the DNS, it now knows exactly where to direct the HTTP request.
A DNS server itself owns a particular public IP address, so to find a mapping of any particular domain, the HTTP request from the browser needs to connect to this DNS server IP first, which are mostly configured and owned at the first level by the ISPs. This means that the BSNL Broadband connection that you might be using, most probably would be pointing to the DNS servers owned by BSNL itself. The DNS servers might be categorized to primary and secondary based on the number of DNS servers managed by the ISP. So there is a whole hierarchy of public DNS servers communicating over a private network across the web. The ones owned by the ISPs lie at the lowest level, which you can consider to contain very selective domain mapping entries most commonly used by any user.
But now a very obvious question comes to our mind, why are so many DNS servers and their hierarchies being managed, when only one DNS root server could have served the purpose? We understand that DNS root servers contain the mapping of all the domains existing across the web and lies at the top in the DNS hierarchy. But imagine, there are millions of website and another million users. So what would happen if all the users start hitting the same root DNS server? Boom!!! It would definitely crash badly. Even if we ignore this menace, it would have taken unacceptably too long to find a particular domain from a list of millions. So what we could have done best to optimize all this? It is for this reason, a hierarchy of the DNS servers are maintained, so the HTTP request from the browser hits the DNS server X at the lowest hierarchy first. If the domain name entry is found at the lowest DNS hierarchy, it would hardly take any time in responding back to the browser with the corresponding IP address of the domain. Assuming that a user is trying to visit the website jcombat.com and the domain entry (jcombat.com) is in case not found in the DNS server X, the DNS server X becomes the client and sends a request to the next DNS server Y in the DNS hierarchy, which, lets assume, ultimately contains the domain mapping for jcombat.com. This domain mapping is returned to the DNS Server X, which expecting a similar request from the user in near future keeps it in its cache. The corresponding IP address of the domain (jcombat.com) is then happily returned to the browser from which the request was made, and the browser now knows where exactly to send the request.
Refer the diagram below that would bring out a much clear picture in your mind:
I hope with the above provided explanation, the diagram will not be that difficult to understand.