Skip to main content

Command Palette

Search for a command to run...

How DNS Resolution Works

Updated
•View as Markdown
How DNS Resolution Works
A
Backend Developer

You type:

google.com

Hit Enter…

And the website loads instantly.

But here’s the real question:

  • How does your browser know where Google lives?

Because computers don’t understand names like google.com.

  • They understand IP addresses like:
142.250.183.14

So how does this translation happen?

  • That’s where DNS (Domain Name System) comes in.

What is DNS?

DNS is like the internet’s phonebook

  • You search by name → get phone number

  • You type domain → get IP address


Why DNS Exists

Without DNS:

You would have to remember IPs like:

142.250.183.14 instead of google.com

Clearly not practical.

DNS makes the internet human-friendly


What is dig?

dig = Domain Information Groper

It’s a tool used to:

  • Inspect DNS records

  • Debug DNS issues

  • Understand how resolution works


Step 1: Root Name Servers

Run:

dig . NS

This asks:

“Who are the root DNS servers?”

Output Meaning:

  • Lists root servers (like a.root-servers.net)

  • These are the top of DNS hierarchy


Step 2: TLD Name Servers

Run:

dig com NS

This asks:

“Who manages .com domains?”

Output:

  • Returns TLD servers (like a.gtld-servers.net)

These servers know:

  • Where google.com is managed

Step 3: Authoritative Name Servers

Run:

dig google.com NS

This asks:

“Who is responsible for google.com?”

Output:

  • Returns authoritative servers

  • Example: ns1.google.com

These servers contain actual IP mapping


Step 4: Full DNS Resolution

Run:

dig google.com

This shows:

  • Final IP address

  • Query time

  • DNS response details


Full DNS Resolution Flow

Let’s connect everything step-by-step:

What happens when you type a URL?


1. Browser checks cache

  • Already resolved? → Use it

2. OS cache check

  • Stored locally?

3. Recursive Resolver (ISP DNS)

If not found:

  • Request goes to DNS resolver (like your ISP or Google DNS)

4. Root Server

Resolver asks:

“Where is .com?”


5. TLD Server

Then asks:

“Where is google.com?”


6. Authoritative Server

Finally asks:

“What is the IP of google.com?”

Gets the answer


7. Response returned

  • Resolver → Browser

  • Browser → Server

Website loads


Visual Flow

Browser
  ↓
Recursive Resolver
  ↓
Root Server
  ↓
TLD Server (.com)
  ↓
Authoritative Server (google.com)
  ↓
IP Address

Important Concept: NS Records

NS (Name Server) records tell:

“Which server is responsible for this domain?”


Example:

dig google.com NS

Means:

  • “Who controls google.com DNS?”

Real-World Insight (Important)

Your browser does NOT contact root servers directly

Instead:

  • It talks to a recursive resolver

  • Resolver does all the work


Why This Matters

Understanding DNS helps you:

  • Debug production issues

  • Understand latency

  • Configure domains

  • Work with CDNs and load balancers


Final Thought

DNS is not just a concept.

It’s the first step of every web request

Without DNS:

The internet doesn’t work.

More from this blog

A

Ashish Jha · Dev

34 posts

A personal blog where I write simple and practical explanations about backend development, Git, JavaScript, and full-stack web development as I learn and build.