Skip to main content

Command Palette

Search for a command to run...

How DNS Resolution Works

Published
5 min read
How DNS Resolution Works

Whenever you type a website like:

google.com

Your browser doesn't magically know where Google is located. Behind the scenes, a process runs to convert that name into an IP address. This process is called DNS resolution.

Many beginners think DNS is just a simple lookup, but in reality, DNS works in layers, like asking for directions step by step.

In this blog, I'll explain how DNS resolution really works and how you can see it yourself using a tool called dig.

What is DNS and Why Name Resolution Exists

DNS stands for Domain Name System.

Simple idea:

DNS = Internet’s phonebook

Humans like names:
👉 google.com
Computers like numbers:
👉 142.250.xxx.xxx

So DNS exists to translate names into IP addresses.

Without DNS:

  • You would have to remember IPs

  • Websites would be very hard to use

  • The internet would feel broken

So DNS resolution is the process of:

Converting a domain name into an IP address

What is the dig Command and When It Is Used

dig stands for Domain Information Groper (weird name 😅).

dig is a command-line tool used to:

  • Inspect DNS records

  • Debug DNS issues

  • Understand how DNS resolution works

  • See which servers are answering

Think of dig like:

X-ray for DNS

Browsers hide DNS from you.
dig shows you what is really happening.

Example:

dig google.com

This shows DNS data that your browser normally hides.

Backend, DevOps, and network engineers use dig a lot.

Click Here to Learn Beginner dig Practice Lab


DNS Resolution Happens in Layers

DNS works in a hierarchy:

  1. Root name servers

  2. TLD name servers (.com, .org, .in, etc.)

  3. Authoritative name servers (for the exact domain)

So real flow looks like:

Root → TLD → Authoritative → Final Answer

Let’s walk through this slowly using dig.

Understanding dig . NS — Root Name Servers

Command:

dig . NS

This asks:

Who manages the root of DNS?

The root (.) is the top of the DNS hierarchy.

Root servers do NOT know IP of google.com.
They only know:

Which servers manage .com, .org, .net, etc.

Think of root servers like:

Country-level directory

They don’t know your house.
They only know which state to ask.

So root servers say:

👉 “For .com, ask these TLD servers.”

Understanding dig com NS — TLD Name Servers

Command:

dig com NS

This asks:

Who manages the .com domains?

These are TLD (Top-Level Domain) servers.

They also don’t know google.com IP.
They only know:

Which name servers are responsible for google.com

Think of TLD servers like:

State-level office

They don’t know your exact house.
They only know which city office to ask.

So .com servers say:

👉 “For google.com, ask these authoritative servers.”

Understanding dig google.com NS — Authoritative Name Servers

Command:

dig google.com NS

This asks:

Who is responsible for DNS of google.com?

These are authoritative name servers.

These servers actually control:

  • A records

  • AAAA records

  • MX records

  • CNAME, TXT, etc.

Think of authoritative servers like:

City office that knows your exact address

They are the final source of truth for the domain.

So now we know:

👉 These servers can give us the real IP of google.com

Understanding dig google.com — Full DNS Resolution

Command:

dig google.com

This is what most people run.

Behind the scenes, this is what happens:

  1. Your system asks a recursive resolver

  2. Resolver asks root servers

  3. Root points to .com servers

  4. .com points to google.com authoritative servers

  5. Authoritative servers return IP

  6. Resolver gives IP back to you

You only see the final answer, but many steps happened.

This is full DNS resolution.


What Are NS Records and Why They Matter

NS records tell:

Which servers are authoritative for a domain

They are important because:

  • They define control

  • They define trust

  • They define where truth lives

If NS records are wrong:

❌ DNS breaks
❌ Website goes down
❌ Emails can stop

So NS records are a core part of DNS design.

Recursive Resolvers: The Hidden Worker

Your computer usually does not talk to root servers directly.

It talks to a recursive resolver, like:

  • ISP DNS

  • Google DNS (8.8.8.8)

  • Cloudflare DNS (1.1.1.1)

Recursive resolver:

  • Does the full root → TLD → authoritative work

  • Caches results

  • Gives you fast answers

So your system says:

👉 “Hey resolver, find google.com for me.”

Resolver does all the heavy work.

Connecting This to Real Browser Requests

When you type google.com in your browser:

You are NOT talking to root servers.
You are talking to a recursive resolver.

But conceptually, the browser depends on this full chain:

Root → TLD → Authoritative → IP → Website loads

So DNS resolution is a core system design part of the internet.

Mental Model (Simple Way to Remember)

Think like asking address:

  1. Ask country office (root)

  2. Ask state office (.com)

  3. Ask city office (google.com NS)

  4. Get house address (IP)

This mental model makes DNS much easier.


Final Words for Beginners

DNS resolution is not magic.
It is a step-by-step distributed system.

Important things to remember:

  • DNS is hierarchical

  • Root, TLD, and authoritative servers have different roles

  • dig helps you see the real process

  • Recursive resolvers do the hard work for you

  • Browsers depend on this system every time you open a site

Once you understand this, DNS, hosting, cloud, and networking concepts will feel much clearer.

More from this blog

H

Hustler Anas

10 posts