How DNS Resolution Works
Breaking Down DNS Resolution with Real dig Examples

❀ Introduction :
⤷ Every time you type google.com in your browser, something important happens in the background.
Your computer does not understand website names. It only understands IP addresses.
⤑ DNS (Domain Name System) helps convert:
google.com → IP address
⤑ That is why DNS is called the internet’s phonebook.
⤑ In this blog, we will understand how DNS works step by step using a tool called dig.
❋ What is DNS and Why Do We Need It?
⤑ Humans like easy names:
⤑ Computers like numbers:
- 142.250.185.46
⤑ Without DNS:
You would need to remember IP addresses
Websites changing servers would break bookmarks
⤑ DNS solves this by:
Mapping domain names to IP addresses
Working in a distributed way, not from one single server
Making the internet fast, scalable, and reliable
❋ What is dig and Why Is It Used?
⤑ dig stands for Domain Information Groper.
⤑ It is a command-line tool used to:
Check DNS records
Understand how DNS resolution works
Debug DNS problems
Learn DNS deeply
Basic command:
dig google.com
Unlike browsers (which hide DNS details), dig shows exactly what is happening.
❋ DNS Works in Layers (Hierarchy)
DNS is not one server.
It works in three main layers:

Each layer only knows the next layer, not everything.
❋ Layer 1 : Root Name Servers (dig . NS)
Command:
dig . NS
This asks:
Who manages the root of DNS?
What root servers do:
They are the top of DNS
They do NOT know website IPs
They only know where TLD servers are
Example response idea:
I don’t know google.com, but I know who manages .com
Important points:
There are 13 root server names
They are spread across the world
Very reliable and fast
❋ Layer 2 : TLD Name Servers (dig com NS)
Command:
dig com NS
This asks:
Who manages the .com domain?
What TLD servers do:
They manage domains like
.com,.org,.netThey do NOT know IP addresses
They point to authoritative servers
Example response idea:
I don’t know google’s IP, but I know Google’s name servers
❋ Layer 3 : Authoritative Name Servers (dig google.com NS)
Command:
dig google.com NS
This asks:
Who is responsible for google.com?
Authoritative servers:
Are owned by the domain owner (Google)
Store real DNS records
Are the source of truth
They contain:
A records (IP address)
MX records (email)
TXT records (verification)
Example:
ns1.google.com
ns2.google.com
These servers finally know:
Yes, this is the IP address of google.com
❋ Full DNS Resolution (dig google.com)
Command:
dig google.com
This gives:
IP address
TTL (how long it can be cached)
Which DNS server answered
⤑ What happens behind the scenes:
Check cache
Ask root server
Root points to
.com.compoints to Google serversGoogle server returns IP
Result is cached
TTL example:
300 seconds
Means the result can be reused for 5 minutes.
❋ What Are NS Records and Why Are They Important?
⤷ NS (Name Server) records tell:
Who controls a domain
Where DNS queries should go next
⤑ They are important because:
DNS is distributed
No single server controls everything
Multiple servers give backup (redundancy)
If one server fails, another works.
❋ What is a Recursive Resolver?
⤷ Your computer does not talk to root servers directly.
⤑ Instead, it uses a recursive resolver, such as:
8.8.8.8 (Google DNS)
1.1.1.1 (Cloudflare DNS)
ISP DNS
Flow:
Your PC → Recursive Resolver → Root → TLD → Authoritative
⤑ The resolver:
Does all DNS work for you
Caches results
Returns final IP
❋ DNS and Real Browser Requests
⤷ When you open a website:
Browser checks cache
OS checks cache
Recursive resolver is asked
DNS resolution happens
IP address is returned
Browser connects using HTTP/HTTPS
⤑ DNS usually takes:
20–120 ms if not cached
<10 ms if cached
That’s why DNS feels instant.
❋ DNS from a System Design View
⤑ DNS is designed to be:
Distributed
Fast
Fault-tolerant
Scalable
⤑ Important ideas:
Caching improves speed
Multiple name servers improve reliability
DNS helps CDNs route users to nearby servers




