Understanding DNS Resolution using dig

Learning web development in public. Writing simple, real-world explanations about web development concepts. Helping beginners understand why things work, not just how.
Search for a command to run...

Learning web development in public. Writing simple, real-world explanations about web development concepts. Helping beginners understand why things work, not just how.
No comments yet. Be the first to comment.
Every day, millions of users upload photos, videos, stories, and reels to Instagram. From a user's perspective, the process appears simple: select media, apply filters, add a caption, and tap "Post."
Building Offline-First Messaging Apps: How Messages Work Without Internet Modern messaging applications have transformed the way people communicate. Whether it's chatting with friends, collaborating w
In this article we'll explore about the Expo Router and React Navigation and answer which one to use in 2026. If you build mobile apps using React Native, one thing becomes obvious very quickly: Navig

Modern mobile apps are no longer just a collection of screens connected together. Apps like Instagram, WhatsApp, Uber, and Netflix operate at massive scale with millions of users, real time systems, o
In this article we'll be exploring react.js and the things of react.js that makes it popular and stand out among other libraries ( no fight over library vs framework ). We'll go through: What problem

Shkaai
68 posts
Computers do not understand names like google.com.
They only understand IP addresses.
Humans, on the other hand, cannot remember IPs easily.
So we needed a system that could answer one simple question:
“If I give you a domain name, where exactly is it located?”
That system is called DNS (Domain Name System).
DNS works like the internet’s phonebook:
Name → IP address
google.com → some numeric address
This process is called name resolution.
When you open a website in a browser, DNS resolution happens silently in the background.
You never see:
which server was asked
who replied
where the information came from
As developers and system designers, we should not trust magic.
That’s why we use dig.
dig and why use it?dig (Domain Information Groper) is a DNS diagnostic tool.
In simple words:
digallows us to ask DNS questions and see exactly who answers what.
Browsers hide DNS.dig exposes it.
Think of it as:
cURL for DNS
DNS is not one big server.
It works in layers, so the internet can scale:
Root DNS
↓
TLD DNS (.com, .org, .in)
↓
Authoritative DNS (domain owner)
Each layer answers only one type of question.
dig . NS)dig . NS
This command asks:
“Who are the root name servers of the internet?”
Root servers do not know anything about google.com.
Their only job:
“I know who handles
.com,.org,.net, etc.”
They are the starting point of every DNS lookup.
dig com NS)dig com NS
This asks:
“Who is responsible for the
.comdomain?”
These servers are called TLD (Top Level Domain) servers.
They do not know IP addresses either.
Their job:
“For
google.com, ask these authoritative servers.”
dig google.com NS)dig google.com NS
This asks:
“Who is authoritative for google.com?”
The response contains NS records.
An NS record answers one question:
“Which DNS servers are allowed to give final answers for this domain?”
Example (simplified):
google.com → ns1.google.com
This is critical because:
DNS must be trustworthy
Only the domain owner should give final answers
Without NS records:
DNS would not know whom to trust
Domain resolution would fail
dig google.com)dig google.com
This gives the final answer — usually an A record (IP address).
But behind the scenes, this is what really happened 👇
Client (Browser / dig)
|
| 1. "Who handles .com?"
v
Root DNS Server
|
| 2. ".com is handled by these servers"
v
TLD DNS Server (.com)
|
| 3. "google.com is handled by Google DNS"
v
Authoritative DNS (Google)
|
| 4. "Here is the IP address"
v
Client connects to server
All of this happens in milliseconds.
Your browser does not talk to root servers directly.
Instead, it asks a recursive resolver:
ISP DNS
Google DNS (8.8.8.8)
Cloudflare DNS (1.1.1.1)
The resolver:
Performs the full root → TLD → authoritative journey
Caches results
Returns the final answer to your browser
This is why DNS feels fast even though it involves multiple steps.
dig google.com to real browsersWhen you type:
https://google.com
Your browser:
Asks recursive resolver
Resolver performs DNS resolution
Gets IP address
Browser connects to server
Website loads
dig google.com simply lets you observe step 3 clearly.
Understanding DNS helps you:
Debug production issues
Design scalable systems
Understand CDNs
Handle failover correctly
Avoid blind trust in “it just works”
DNS is not magic.
It is well-designed distributed system engineering.
DNS exists to translate names into addresses, but its real power lies in how it distributes responsibility across the internet.
Using dig, we can peel back the layers and see:
who controls what
how trust is established
how browsers actually reach servers
Once DNS clicks, many networking and system-design concepts become much clearer.