Understanding How DNS Resolution Works Step-by-Step
Understanding the Internet’s Phonebook Through dig

🧐 Overview
If the internet were a city, DNS would be the address book that ensures you reach the right house instead of wandering aimlessly.
You type google.com.
Your browser finds the correct server among billions of machines worldwide.
That "somehow" is DNS resolution.
📖 What Is DNS and Why Name Resolution Exists
Computers do not understand names.
They understand IP addresses (numbers).
Humans type:
google.comComputers need:
142.250.xxx.xxx
DNS (Domain Name System) exists to translate names → numbers.
Real-life example 🏠
Think of DNS like asking for an address:
You say:
“Take me to Rahul’s house.”
The system figures out:
Which city
Which area
Which exact house
You don’t care how — you just want to arrive.
🛠️ What Is the dig Command and When It Is Used
Browsers hide DNS completely.dig removes the curtain 🎭.
dig (Domain Information Groper) is a diagnostic tool that lets you:
Inspect DNS resolution
Debug DNS problems
See which servers are involved
Understand why a domain resolves the way it does
Think of dig as:
🩻 An X-ray for DNS
🧱 DNS Resolution Happens in Layers
DNS is not one big database.
It’s hierarchical.

The three layers 🪜
Root name servers (
.)TLD name servers (
.com,.org,.in)Authoritative name servers (domain owners)
Each layer answers only one question:
“Who should I ask next?”
🌍 Understanding dig . NS — Root Name Servers
dig . NS
This asks:
“Who manages the root of the internet?”
What root servers do
They do not know IP addresses
They do not know websites
They only know where TLDs live
🧠 Mental model:
Root servers are the index page of the internet.
They simply say:
“If you’re looking for
.com, go there.”
🏷️ Understanding dig com NS — TLD Name Servers
dig com NS
This asks:
“Who manages all
.comdomains?”
What TLD servers do
Handle millions of domains
Still don’t know Google’s IP
Know who owns each domain
Their answer is basically:
“For
google.com, ask Google’s name servers.”
🏠 Understanding dig google.com NS — Authoritative Servers
dig google.com NS
This is the most important step.
These servers are authoritative because:
They own the DNS records
They store the final truth
They manage:
IP addresses (A/AAAA records)
Mail routing (MX)
Verification & security (TXT)
🚨 If these servers go down → the site goes down.
🎯 Understanding dig google.com — Full DNS Resolution
dig google.com
google.com → 142.250.xxx.xxx
This is the only thing the browser actually needs.
Everything before this was just:
Finding the right person to ask.
🔄 What Really Happens When You Type a Website

Behind the scenes:
Browser asks a recursive resolver
Resolver asks root servers
Root points to .com
.compoints to Google’s authoritative serversGoogle returns the IP
Resolver caches the result 🧠
Browser connects to the IP 🌐
You only see:
“The page loaded.”
🧑🔧 Recursive Resolvers: The Hidden Workers
Your browser never talks to root servers directly ❌.
A recursive resolver does the heavy lifting.

What it does:
Walks the DNS hierarchy
Caches responses
Reduces global DNS load
That’s why:
First visit = slower 🐢
Next visit = instant ⚡
🧠 What NS Records Represent (and Why They Matter)
NS records answer one question:
“Who is allowed to speak for this domain?”
From a system-design perspective:
NS records define trust
Enable scalability
Allow failover
Power CDNs and geo-routing
💡 Control NS records = control traffic.
🗺️ Mapping dig Commands to DNS Stages

dig command | DNS layer | What it shows |
dig . NS | Root | Who runs DNS |
dig com NS | TLD | Who runs .com |
dig google.com NS | Authoritative | Who owns Google |
dig google.com | Final | IP address |
🌐 Connecting DNS to Real Browsers
Before:
HTTP
HTTPS
APIs
Load balancers
Microservices
There is always:
DNS first
No DNS ❌
No connection ❌
No internet ❌
🧩 Final Mental Model (Keep This Forever)
DNS is layered, not magical ✨
Each server knows just enough
Recursive resolvers glue everything together
digexposes realityBrowsers hide complexity
Once DNS clicks, the internet stops feeling mysterious - and starts feeling engineered



