How DNS Resolution Works

What is DNS and Why Name Resolution exists
As Our Internet works on IP Addresses , not on names .
Computers communicates using the numeric identifier like 192.145.53.14 .
We humans prefer names like Google.com
DNS (Domain Name System) translate the human readable domain names (Google.com) into machine readable form IP Addresses (168.123.63.21) .
DNS is like a big phonebook :
You look for a name (facebook.com)
DNS gives you corresponding IP address
Browser using that IP address connects you to the server
Without DNS we have to memorize each an every IP addresses of every website .
What Is the dig Command and When It Is Used
dig (Domain Information Groper) is a DNS analysis tool.
It allows you to
To directly Query the DNS servers
Inspect DNS records (A, NS, CNAME, AAA , etc.)
Understand how name resolution works step by step
Why we use dig
To Debug the DNS issues
To Verify configuration of domains
Learn how DNS resolution actually happens
Troubleshoot latency or misrouting problems
Unlike a browser, dig shows you raw DNS responses.
dig . NS & Root Name servers
dig . NS
. represents the DNS root
NS asks for name server records
After this command you will see a list like :

Root name servers
It has no idea about IPs of websites . It only know about where to find name servers .
Root servers are the starting point they answer the questions like “Who is responsible for .com , .in , .net , .org , etc ?“
dig com NS & TLD Name Servers
dig com NS
This means asking the root servers “Who manages the .com Domain?“
After this command you will see a list of servers :

Role of TLD name Servers
TLD Servers manages top level domains ( .org , .in , .com , .gov )
They also know which authoratative servers handle each domain .
TLD servers are like Directories they answer to “Who is responsible(Manages) for instagram.com“
dig google.com NS & Authoritative Name Servers
dig google.com NS
It is a Query to TLS Servers ; Asking for authoratative name server of google.com
We can see servers like

What authoritative servers do
They Store actual DNS records and also they Provide final answers (A, AAAA, MX, TXT) .
Authoritative servers are the source of truth .
Why NS records matter
NS records define:
Who controls the domain
Where updates propagate from
How DNS delegation works
dig google.com & Full DNS Resolution flow
dig google.com

What happens behind the scenes
Your recursive resolver (usually your ISP or public DNS like 8.8.8.8):
Queries the root servers
then gets .com TLD servers
Queries the TLD servers
then gets google.com authoritative servers
Queries the authoritative servers
then receives the A record (IP address)
Output section -:
google.com. 112 IN A 142.261.43.164
This is the IP our browser will connect to.



