Skip to main content

Command Palette

Search for a command to run...

How DNS Resolution Works

Published
3 min read

Whenever we type a website like “google.com” into a browser, it loads in milliseconds.
But behind that simple action, a layered system works quietly to figure out where that website lives.

This article is about understanding how DNS resolution actually happens, using the dig command as our tool.

DNS is often called the phonebook of the internet, humans use names like google.com but computers use IP addresses. The names that we use is converted into an IP Addresses in layers and how it happens we are going to learn about it more.

Why name resolution exists at all?

As we know the internet is huge, decentralized and constantly changing, there isn’t a single server that knows everything. So DNS is designed as a hierarchical system, where responsibility is divided across multiple layers. This makes DNS scalable, reliable and fault tolerant.

What is the dig command?

dig stands for Doman Information Groper. It is simply a diagnostic tool to inspect how DNS resolution works. Browsers keep resolving DNS quietly in the background and dig lets us see that process.

We use dig to various purposes:

Debug DNS issues, inspect name servers, understand resolution paths, verify DNS configuration.

DNS resolution moves step by step: Root → TLD → Authoritative

Each layer answers only what it is responsible for

Understanding dig .NS

dig .NS when use this command in the terminal it is simply like asking “Who is responsible for the root of DNS?“

And the output lists the root name servers.

Root servers don’t know the IP’s for websites, they only know who handles them like .com, .net, .org, .ind etc.

In simple words think of their reply like “I don’t know the answer, but I know who to ask next.”

There are only a few root servers globally, and they are extremely critical.

Understanding dig com NS

dig com NS this command asks “Who is responsible for .com domains?” They are Top-Level Domain (TLD) name servers.

They don’t know Google’s IP, but they know which authoritative servers manage google.com, so they point forward and not give final answers.

Understanding dig google.com NS

dig google.com NS This asks “who is the authority for google.com“. The response lists authoritative name servers.

Why Authoritative Servers Matter?

These servers store actual DNS Records, they know A, AAAA, MX, TXT, etc., and these servers are the source of truth for the domain.

Let me try and put it this way, if DNS was a company: root - directory, TLD → Department, authoritative → actual team owning the data.

Understanding dig google.com

dig google.com This is what browsers effectively do via recursive resolvers. This command returns the final IP addresses, A/AAAA records.

Behind the scenes the recursive resolver asks root servers, root servers points to .com servers, then .com points to the Google’s authoritative servers and these authoritative servers return the IP address.

So, dig google.com shows the end result of that entire process.

dig . NS → Root

dig com NS → TLD

dig google.com NS → Authority

dig google.com → Final Answer