Understanding DNS Resolution

Before starting to our name resolution topic let me clear some basic terminology’s such as DNS and DNS resolution are 2 different things . They often used interchangeably in casual conversation, but they are different aspects of technology.
How are they differ from each other
DNS (Domain Name System) : This is an entire system or Infrastructure itself. It is a global database that stores records and maps domain names to IP addresses. We can say it as a “Phonebook” of internet. For eg. Hostinger, GoDaddy, Versel etc.
DNS Resolution : This is an active process or action of using that system to find answers. It is a multiple step process. Starting from user request through various servers like Root,TLD and Authorotative servers to resolve user request.
Overview
In this blog we will understand how this process of DNS Resolution works in detailed and simple way. Along with that we will understand about Dig and Dig commands.
How DNS Resolution works

Here are some simple steps how this whole process works.
First the user requests the browser to open
Chaicode.comin his browser. The browser searches for the domain in its cache if its not available there then It will take his request to.comdomains list or we can say into Recursive DNS.The recursive DNS will now search for the domain in its cache if its not there then it will redirect the request to Root Server
The Root server will now tell the recursive DNS to go to this specific TLD(Top Level Domain) server that manages information for specific domain like
.com,.org,.govetc.Now the Recursive DNS will go to the specific TLD server and will ask for
chaicode.com.The TLD server will provide us the NS(name server)
The Recursive DNS will go to the Authoritative DNS server to get the IP address for our website
Authoritative DNS will give IP address like 143.11.12.1 to our recursive DNS
Then it gives IP address to browser so that the user can get access for the Web site he wants.
Unleashing the Curiosity

Ever wondered what if we can get the record of IP address also the name server of the website directly into our computer. Yes, we can do that thing using DIG (Domain Information Groper). We just simply type the command dig chaicode.com in terminal or warp then it will directly tell us the IP address and DNS details for that website.
How dig works and what is role of DIG !
DIG is a query tool that asks DNS servers about how a domain name get resolved to a IP address.
How it works
Chaicode.com then dig does not open the website like browser does but it will ask the DNS servers to tell us everything they know about this website. DIG let you see the conversation that how the browser sents query to root severs , which TLD server are included there and who is authoritative DNS server of that website and what is the IP address of that site.Some useful DIG commands

DIG.NS
NS is a DNS record type. It indicates which server are responsible for the domain names. It show us the Authoritative server
dig com NS
This shows DIG which is a query tool,
.comwhich is a TLD and NS asks for name for that TLD where .com is available. It returns the TLD servers where .com is located.Dig google.com NS
It finds the name server which are authoritative for the domain google.com it returns something like.
google.com. NSns1.google.com.google.com. NSns2.google.com.google.com. NSns3.google.com.Dig google.com
It asks DNS about the IP address of google.com also asks for the record type of the domain and its authoritative server . It also returns TTL seconds to reach the server. The output will look something like this.
google.com. 300 IN A 142.250.182.14300→ TTL (seconds)A→ IPv4 record142.250.182.14→ IP address
That’s it . Thank you for reading . Hope you understand the concepts well.




