We visit the ‘N’ number of websites daily. All we need to do is type their URL(Uniform Resource Locator) in the search bar and hit enter. Once we are connected to that website, we get access to all of the offered resources over there. So in this article, I’ll tell you how we are connected to the websites, what is DNS and nameservers. But technically that isn’t enough. For instance, if we had to visit Facebook, we would type in our address bar.
Then we would be navigated to Facebook’s servers where we will be accessing Facebook. But who navigates us to Facebook’s servers? How does it know where Facebook’s servers are? If for instance there were two different websites by the name of Facebook, How would we reach the original website?
All of this is made possible using DNS i.e Domain Name System and nameservers.

What is DNS?
A DNS or Domain Name System is a naming system for devices including web-servers connected to the internet or a private network. The main job of a DNS is to convert the location of a web server on the internet to a more human-readable form. It has been used since the year 1985 when most of the web we see today wasn’t even there. If you had to access websites like TheITstuff, Facebook, YouTube, Google, it would be easier to remember their names instead of remembering the IP address for each website.
How DNS Works?
The DNS can in a very simple definition be called a database where different IP addresses are matched with different names(the URLs). Whenever someone requests a URL, the DNS simply supplies the information of the location(IP address) of that server. This IP address is used to connect to that server and hence you can access that service.
But an important question would be – How does the DNS know the IP address of my website? Does the DNS know all the IP addresses of all websites? What if the DNS doesn’t know the IP address of the website I want to visit?
What Is Nameservers?
The DNS is merely an overall system. The nodes or endpoints in a DNS are called Nameservers. Nameservers are the actual servers that store the records of IP addresses and URLs. Now there are different nameservers we have, the first one is a nameserver run by our ISP(Internet service provider). Most of the time, it has the IP addresses of the websites that we wish to visit. The second would be a Custom Nameserver like that of Google(8.8.8.8 Public DNS). The third one is the Root Nameserver.
The Root nameserver
The Root nameserver is a special type of name server that contains records of all websites of a particular range. If your name server doesn’t have the IP address of some website, it can contact the Root nameservers for it. There are a total of 13 such servers. If the root server you contacted doesn’t have the location of that website, it will ask the authoritative name servers from that TLD(Top Level Domain). A Top-Level Domain is the last part of the domain like .com, .org, .net, etc. Once it has obtained that IP, your primary name server might save it for future use. Also, your computer might save the DNS of your visited sites to save time later.
Conclusion
In the olden times, there used to be a single host file that contained the IP addresses of the sites that were available, whenever a new site would be added they would manually update that file and you had to update your file to access newer sites. With the internet scaling at exponential speeds, this was no longer feasible and DNS must be established. The DNS constituted of 13 Root Nameservers and a large number of nodes. These nodes would either answer your query themselves or if they couldn’t they would contact the root nameservers who would find it out.