Skip to main content

Command Palette

Search for a command to run...

DNS & dig Explained Simply — From Root to google.com

Published
4 min read

When you type google.com into a browser, a multi-layered distributed system quietly works behind the scenes to convert that name into an IP address.

This article breaks that journey down using the dig command — the best tool to see DNS in action.


What is DNS and Why Name Resolution Exists

DNS (Domain Name System) is the internet’s phonebook.

  • Humans remember namesgoogle.com

  • Computers communicate using IP addresses142.250.x.x

DNS exists to:

  • Decouple human-friendly names from machine addresses

  • Allow IPs to change without breaking users

  • Scale name resolution across the entire internet

📌 DNS is distributed, hierarchical, and fault-tolerant by design.


What is the dig Command and When It Is Used

dig (Domain Information Groper) is a DNS inspection tool.

It is used to:

  • Debug DNS issues

  • Inspect NS, A, MX, TXT records

  • Understand where answers come from

  • Trace DNS resolution step by step

Think of dig as Wireshark for DNS logic.


DNS Resolution Happens in Layers

DNS works top-down:

  1. Root name servers

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

  3. Authoritative name servers

  4. Final answer (IP address)

Let’s walk through each layer using dig.


Understanding dig . NS — Root Name Servers

dig . NS

This asks:

“Who controls the root of DNS?”

You’ll see servers like:

What This Means

  • Root servers don’t know IPs

  • They only know which servers handle each TLD

  • There are 13 logical root servers, globally replicated

https://images.openai.com/static-rsc-3/v7iHjuBYNqVRIO8sGA2khay3jxWvJ-wQK_-u_3UTtvcztya5Ve846LVrhaOfj4drOYlXNwySKiKw87vsxVi99mTSoj1OXp8hdBEHhqgasME?purpose=fullsize

https://www.inetdaemon.com/img/dns-hierarchy.gif

https://upload.wikimedia.org/wikipedia/commons/thumb/e/ee/Root-current.svg/500px-Root-current.svg.png

📌 Root servers are the starting point, not the answer.


Understanding dig com NS — TLD Name Servers

dig com NS

This asks:

“Who manages .com domains?”

You’ll see name servers operated by Verisign.

What This Means

  • .com servers don’t know google.com’s IP

  • They know who is authoritative for google.com

  • This layer enables massive scalability

https://images.openai.com/static-rsc-3/v7iHjuBYNqVRIO8sGA2khay3jxWvJ-wQK_-u_3UTtvcztya5Ve846LVrhaOfj4drOYlXNwySKiKw87vsxVi99mTSoj1OXp8hdBEHhqgasME?purpose=fullsize

https://miro.medium.com/1%2A-kCFoSB3-pMwajK6LTJY6Q.jpeg

https://www.researchgate.net/publication/342547942/figure/fig1/AS%3A907969327800320%401593488165786/llustration-of-DNS-resolution-over-recursive-root-TLD-and-authoritative-name-server.png

📌 TLD servers act as delegators, not resolvers.


Understanding dig google.com NS — Authoritative Name Servers

dig google.com NS

This asks:

“Who has the final authority for google.com?”

You’ll see:

What This Means

  • These servers own the DNS records

  • They provide A, AAAA, MX, TXT records

  • This is the source of truth

https://images.ctfassets.net/aoyx73g9h2pg/4jspUaV5ndvujB7PBgbRAF/e55e5252aac392a1a6c1ed2327a1be81/Authoritative-Name-Servers-Diagram.jpg

https://cordero.me/images/dns1.PNG

📌 Authoritative servers give final answers, not referrals.


Understanding dig google.com — Full DNS Resolution Flow

dig google.com

This returns:

  • A record (IPv4)

  • TTL values

  • Query time

  • DNS flags

What Actually Happened (Behind the Scenes)

Your recursive resolver:

  1. Queries root servers

  2. Gets .com name servers

  3. Queries TLD servers

  4. Gets google.com authoritative servers

  5. Queries authoritative servers

  6. Caches the result

  7. Returns IP to browser

https://www.researchgate.net/publication/258817221/figure/fig1/AS%3A360932380299270%401463064393598/Recursive-DNS-resolution.png

https://assets.bytebytego.com/diagrams/0176-dns-look-up.png

https://www.researchgate.net/publication/330006223/figure/fig1/AS%3A709642057445377%401546203259697/Domain-resolution-process-with-a-recursive-resolver.ppm

📌 dig google.com hides the complexity — but the hierarchy still applies.


What NS Records Represent (And Why They Matter)

NS (Name Server) records tell DNS:

  • Who is responsible for a domain

  • Where to forward queries next

They enable:

  • Delegation

  • Load balancing

  • Fault tolerance

  • Global scale DNS

Without NS records, DNS cannot function.


How Recursive Resolvers Use This Information

Recursive resolvers:

  • Perform lookups on your behalf

  • Cache responses to reduce latency

  • Respect TTL values

  • Protect users from querying roots every time

📌 Your browser never talks to root servers directly — resolvers do.


Connecting dig Output to Browser Requests

When you type:

https://google.com

Your browser:

  1. Resolves DNS → gets IP

  2. Opens TCP connection

  3. Negotiates TLS

  4. Sends HTTP request

📌 DNS is always the first network dependency.


Mental Model Summary

LayerCommandResponsibility
Rootdig . NSPoints to TLDs
TLDdig com NSPoints to domains
Authoritativedig google.com NSOwns records
Final Answerdig google.comReturns IP

Why This Matters in System Design

Understanding DNS helps you:

  • Design high-availability systems

  • Debug production outages

  • Optimize latency

  • Understand CDN behavior

  • Architect global services

DNS is not “just networking” — it’s core infrastructure logic.

More from this blog

C

CHAIAURCODE-->WEBCOHORT

13 posts