The Internet is just a network of ‘n’ computers that can communicate over various communication channels. Now, anything you do on the Internet is only an exchange of information(through files, scripts, etc.) So for the exchange to happen, you need to locate the other counterpart and vice versa. Like the addresses we use in our daily life, each device on the Internet is given a unique IP address. This IP address is used for locating and communicating between the two devices. To provide you with an idea of how an IP address looks, here is one for your reference 2400:cb00:2048:1::c629:d7a2 (in IPv6). You may have by now realized that this address is not human friendly—this is where the Domain Name System (DNS) comes to our rescue.
What is the Domain Name System?
We use phrases like XYZ.com to surf the Internet. What Domain Name System(DNS) does is it maps the phrase that we use to IP address from where the resource needs to be fetched. It is like a phonebook with IP addresses corresponding to each domain name for the machine to use.
Types of DNS servers and what they do?
DNS recursor – The client machines send queries to DNS recursor through applications such as web browsers. Typically the recursor is then responsible for making additional requests to satisfy the client’s DNS query. It is the link between the application and other DNS servers.
Root nameserver – It gives the first direction to locate the given IP address. It is like an index in a library that points to different racks of books. It serves as a reference to other more specific locations.
TLD nameserver – It further narrows down the search for the IP address by directing the proper location corresponding to the last part of the domain name, e.g., “com.” It is like reaching a specific rack to locate a book in a library.
Authoritative nameserver – This final nameserver converts the specific name into its definition which is like a dictionary on a rack of books, in which a specific name can be translated into its definition. The authoritative nameserver is the last stop in the nameserver query. If the authoritative name server has access to the requested record, it will return the IP address for the requested hostname back to the DNS Recursor that made the initial request.
Steps involved in resolving a domain name
The DNS recursive resolver receives a query generally through a web browser. The resolver then queries a DNS root nameserver (.). The root server then responds to the resolver with the address of a Top-Level Domain (TLD) DNS server (such as .com or .net), which stores the information for its domains. The query is then directed towards the .com TLD. The resolver then requests the .com TLD.
The TLD server then responds with the IP address of the domain’s nameserver, example.com. Lastly, the recursive resolver sends a query to the domain’s nameserver. The name server then returns the IP address of XYZ.com to the resolver. The DNS resolver then responds to the web browser with the IP address of the domain requested initially.
Once this all is completed, the IP address for XYZ.com is passed on to the application, in this case, a web browser. It then starts communication with the device to ask for the resource generally through HTTP.