Skip to main content

Command Palette

Search for a command to run...

How DNS Resolution Works

Published
5 min read

what is DNS?

THE PROBLEM: Computer does not understand the human given names . For example , they do not understand google.com or chaicode.com. They have their own language to understand it . This language is nothing but known as IP address(like 197.98.76.33).

Let's say you type chaicode.com in your browser's URL bar and it loads the website . But how did the computer understand to open this website . we know that it only understands the ip address Vala language
Then how ? Here comes the role of DNS i.e DOMAIN NAME SYSTEM

DNS : DOMAIN NAME SYSTEM is a something like naming system that translates the human-readable domain names into its IP address which is understandable by our computers.

It's like the contacts app on our mobile phones. Suppose you want to call your friend named Riya. You would search for the name Riya in your contacts and call her. It's obvious you wouldn't dial the number because it's hard to remember everyone's number unless it's your girlfriend or boyfriend.
In the same way DNS works. It is known as internet’s phone book.
Here instead of Riya , the domain name is used ( like chaicode.com) and instead of phone number ip address is called ( i.e domain name is converted into IP address like 88.88.88.34 )

You dial “Mom”, not the number obviously
DNS does the same thing — it converts names → numbers
This translation process is known as name resolution.

What is the dig command and when it is used?

DIG stands for Domain Information Groper. It is a tool to query DNS server and how DNS name resolution works. It tells you which DNS servers were contacted , what IP address was returned , how long it took.

IN answer section you can see the chaicode’s ip address , its record name . Also you can observe the query time given after answer section .

Understanding dig . NS and root name servers

This is command used to show the root name servers of the internet. This root servers act as the first checkpoint in the DNS resolution process. Question arises what are root servers ?
: Root Name Servers are the starting point of the DNS resolution process. They tell DNS where to find Top Level Domain (TLD) servers like .com, .org, .in. In DNS, everything starts from the root, represented by a dot (.)
. = root
.com = top domain name [ TLD ]
chaicode.com = domain

Here the NS record means answering the question of “““Which server knows about this domain?”””
when u run these commands it gives you output like this

. 172885 IN NS j.root-servers.net. means the root of DNS is handled by these name servers [j.root-servers.net.]
IN SHORT : THE ROOT SERVERS DONT KNOW CHAICODE.COM BUT THEY KNOW WHO MANAGES THE .COM [TLD SERVERS ] ROOT SERVERS DO NOT KNOW THE IP ADDRESSES OF CHAICODE.COM . THEY ONLY KNOW WHERE TO FIND TLD SERVERS.

Understanding dig com NS — TLD Name Servers

It is also a command which shows the Name Servers responsible for the .com Top-Level Domain (TLD) Now the TLD servers answers the question of Which authoritative servers handle chaicode.com?
output of these command looks like

These servers { like a.gtld-servers.net and b.gtld-servers.net etc } manage all .com domains. TLD servers do not store IP addresses; they only point to authoritative servers.

IN SHORT : I**N FIRST STEP THE DNS ASKS THE ROOT SERVER WHO HANDLES .COM AND ROOT SERVERS REPLIES THAT TO ASK .COM VALA TLD SERVER . NOW DNS ASKS .COM VALA TLD SERVER THAT WHERE IS CHAICODE.COM , TLD REPLIES GO TO AUTHORATIVE SERVERS.**

Understanding dig chaicode.com NS — Authoritative Name Servers

now you already know that this is also one type of command which tells you which DNS servers are officially responsible for the domain chaicode.com.
Authoritative servers answers the question of “What is the IP address of chaicode.com?”
the output of these command looks like this

now here if u see the answer section of output u can observe that chaicode.com uses Cloudflare’s DNS [means ki Cloudflare is managing the DNS records of the website] , and Cloudflare’s name servers are the authoritative servers for this domain.

IN SHORT :I**N FIRST STEP THE DNS ASKS THE ROOT SERVER WHO HANDLES .COM AND ROOT SERVERS REPLIES THAT TO ASK .COM VALA TLD SERVER . NOW DNS ASKS .COM VALA TLD SERVER THAT WHERE IS CHAICODE.COM , TLD REPLIES GO TO AUTHORATIVE SERVERS. AUTHORATIVE SERVES GIVES THE IP ADDRESS OF CHAICODE.COM.**

IN ABOVE THREE COMMANDS THERE IS WORD CALLED NS . THIS NS IS THE NAME SERVER RECORD WHICH ANSWERS THE QUESTIONS OF WHICH SERVER KNOWS ABOUT THIS DOMAIN?

Understanding dig chaicode.com and the full DNS resolution flow

when we run this command it retrieves detailed Domain Name System information for the domain chaicdeo.com.
output for this command looks like

now understand the flow of all this servers and commands

Browser ask to DNS do we know chaicode.com . The DNA then looks for chaicode.com . It ask for who handles the .com ? . The root server tells to ask .com TLD server [it points to TLD server] . The DNS then ask to TLD server that who handles chaidode.com ? TLD replies ask chaicode authoritative server .
And finally the DNS ask authoritative about the IP address of chaicode.com and finally the answers the IP address of chaicode.com .

THANK YOU !