How DNS Resolution Works

Hey Everyone, let’s understand what DNS is.
What is DNS and why does name resolution exist?
DNS stands for Domain Name System.
Computers don’t understand domain names like www.google.com. They understand IP addresses.
On the other hand, we don’t want to remember things like:
Human-readable www.google.com
Machine-readable 19.20.21.2

So DNS exists to solve one simple problem:
Convert human-friendly names into machine-friendly addresses(IP addresses).
That’s it.
It is like a phonebook:
You search by name
You get a number
You make the call
DNS does the same thing on the Internet.
What is the dig command and when it is used
As DNS works in the background
There should be a tool that will help engineers to inspect and debug DNS.
That's where dig comes.
What is dig?
dig stands for Domain Information Groper. It is a command-line tool that:
Queries DNS directly
Shows exactly how name resolution works
is used for debugging, learning, and system analysis
Before running commands, we should get this clear that DNS always flows like this:
Root servers
↓
TLD servers (.com, .org, .net)
↓
Authoritative servers

Understanding dig . NS and root name servers
.[dot] it represent the root. So that means you are asking for name servers of root server.
dig . NS

There are total 13 root servers. Some them are as above. These servers are the starting point of all DNS lookups

Understanding dig com NS and TLD name servers
Now moving forward to finding the .com TLD (Top Level Domain)
Name servers like:
a.gtld-servers.net
b.gtld-servers.net
These are TLD name servers. They don’t know the IP address of google.com but they know the address of the authoritative server which manages google.com
Understanding dig google.com NS and authoritative name servers

These servers are authoritative for google.com. They hold the actual DNS records
Without authoritative servers:
DNS has no final answer
Resolution cannot be completed
What happens behind the scenes
It looks like a single command, but behind the scenes it looks like this:
Ask root servers → “Who handles .com?”
Ask .com servers → “Who handles Google.com?”
Ask Google’s authoritative servers → “What is the IP?”
Return the final answer
And now, you know how DNS really works.
Thanks for reading, and see you in the next blog!
Peace ✌️ and Happy Learning!




