Skip to main content

Command Palette

Search for a command to run...

DNS Working and Records

Updated
4 min read
DNS Working and Records

Searching on a Web Browser , visting a website this has become a daily occurance for us. Around 8.5 billion queries are made daily around the world. Getting used to it, has caused us to never think about what happens when we do that. How does all this occur?!

Problem

When we search for google or type in the link www.google.com, how does the browser know where to go. Does it have a list which tells it, this is the address of website. If there is a list its gonna be pretty long ,with around 1.71 billion entries and still growing, i ensure you simply searching that is gonna take longer than what we can wait for.

Solution

We need to convert www.google.com to a computer understandable ip address like 172.31.1.6 ,but this system must also be scalable and refined.Such a system that was developed is referred to as the DNS(Domain Name System).

Its a system designed for Decenetralisation, Delegation and Loose Coupling. It tells and directs the path through which the request should proceed to reach the ip address.

Lets understand this with help of an analogy:

You made a request regarding finding a particular book to librarian, he first searches for the correct bookshelf by the topic, then he searches for the rack in the bookshelf by further specifying things, like author. After this, the particular book has been found out using the title of book.

Similar to this process is how DNS works. DNS has multiple type of servers each of those plays a role in resolving our query

  • Librarian ←→ DNS Recursor : It recieves request from the browser and then starts the search and adds some additional queries , if required to resolve the request.

  • Bookshelf ←→ Root Name Server : It helps by further specifying down the searching along the root server its related to. There are 13 root servers across whole world, which hold over 1600+ instances.

  • Rack←→TLD Server : It helps us further shorten the search as it hosts the last part of the domain name. for eg:- In google.com , .com is a TLD(Top Level Domain Server) seperately hosting the .com .

  • Book←→Authoratative DNS : It finally after shortlisting the request answers by so much gives us the final ip address, on which the website is hosted. It has many types of records which it could serve based on the type of data to deliver like:- A, AAAA, MX, CNAME records .Cloudflare is a good example of company that provides us Authorative DNS by hosting our website on their provided ip address.

Most of these steps occur at the background without any human intervention. But still there is a thing missing. In analogy, the librarian knew the process to reach a particular book, but here for query made to DNS by the browser there is no such way.So this is the place where NS comes into play.

Use of NS

NS which stands for Name Server, basically tells the system where to proceed after each step. The DNS process is always not a fixed one, it has many cases where after going through TLD, we are rerouted or the Authoratative DNS directs it to another domain name. All this steps are directed through the NS.

System optimisation :

Don’t consider this as a drawback or inconsistency in the system as sometimes it’s actually required to redirect by the system. Such case arrives when a particular IP is down but website is hosted on multiple ip addresses, so returning different IPs based on DNS configuration. This process is used for Load Balancing on websites with high traffic.

  • Caching - For further optimisation of this system, the ip is directly stored as cache in system which contains TTL and NS. This prevents from going through the process of going through Root Name and TLD Server, directly points to the ip. But once you have visited an ip ,it doesn’t stay stored forever, the time its kept stored depends on TTL(Time to Live) , after that its removed.

  • Record Type - It helps to get a specific response and significantly decrease the load. Without record types it would return us IPs, Mail servers,TXT records,NS records and Aliases.

Conclusion

This whole process of DNS resolution and various techniques used to finally complete this journey of reaching the ip address of our website is referred to as DNS Heirarchy. Let’s see the whole process with help of a diagram.

More blogs:

  1. Digging into DNS

  2. DNS Record Types

  3. Deep dive into browser