How DNS Resolution Works ( A Practical, Layer-by-Layer Story)
Think of DNS as the internet’s phonebook. Humans remember names like google.com, but computers talk in IP addresses like 142.250.72.14. DNS exists to bridge that gap turning readable names into routable addresses, billions of times a day, in milliseconds.
As engineers, DNS is one of those systems that just works until it doesn’t. And when it breaks, knowing how resolution actually works becomes priceless.
Let’s build that understanding step by step.
What Is DNS and Why Name Resolution Exists
At its core, DNS (Domain Name System) is a globally distributed, hierarchical database.
Why hierarchical?
Because no single system could realistically store or serve the entire internet’s naming data. Instead, DNS is split into layers of responsibility, each answering only what it knows.
This design gives us:
Scalability (no central bottleneck)
Fault isolation
Delegated ownership (Google controls
google.com, not ICANN)
Introducing dig: Your DNS Debugging Microscope
dig (Domain Information Groper) is a diagnostic tool that lets you inspect DNS resolution, step by step.
When a browser makes a request, all this DNS work happens invisibly. dig lets us slow time down and watch the gears turn.
We’ll use it to query -
Root name servers
TLD name servers
authorotative name servers
dig . NS - Root Name Servers
dig . NS
This asks: “Who is responsible for the root of DNS?”
The response lists root name servers (a.root-servers.net, b.root-servers.net, etc.).
Key insight:
Root servers don’t know IPs for domains
They only know which servers handle each TLD (
.com,.org,.net)
They are traffic directors, not data stores.
dig com NS - TLD Name Servers
dig com NS
Now we ask: “Who manages .com?”
These TLD (Top Level Domain) servers know -
Which authoritative servers are responsible for
ggoogle.comBut not Google’s IP addresses themselves
Think of TLD servers as regional offices closer to the data, but still not the source of truth.
dig google.com NS - Authoritative Name Servers
dig google.com NS
This returns Google’s authoritative name servers.
Important concept -
NS records define delegation
They say: “These servers are the source of truth for this domain”
Authoritative servers are where real answers live -
A / AAAA records
MX records
TXT records
dig google.com - Full DNS Resolution
dig google.com
This is what your browser effectively triggers.
Behind the scenes, a recursive resolver (usually your ISP or public DNS like 8.8.8.8) does the work:
Ask root servers → Who handles
.com?Ask TLD servers → Who handles
google.com?Ask authoritative servers → What is the IP?
Cache the answer and return it to the client
Your browser just waits for the final IP.
Step by Step DNS Resolution for google.com
Browser asks the OS resolver
OS asks recursive resolver
Recursive resolver queries root servers
Root → TLD servers
TLD → authoritative servers
Authoritative → IP address
IP returned → TCP/TLS/HTTP begins
DNS finishes before your first HTTP byte is sent.
Why This Matters in System Design
DNS caching hides latency but introduces staleness
TTL tuning affects failover and resilience
Multi-region systems rely heavily on DNS-based routing
Outages often look like “the internet is broken” but are DNS misconfigurations
understanding DNS isn’t optional, it’s foundational.