Skip to main content

Command Palette

Search for a command to run...

The DNS Journey: How Your Browser Finds the Internet (And Why Your ISP Knows Everything)

Here's what I learned about how DNS actually works, the players involved, and why your ISP is basically the middleman you never asked for.

Updated
5 min readView as Markdown
The DNS Journey: How Your Browser Finds the Internet (And Why Your ISP Knows Everything)
P
Backend developer exploring AI agents, backend systems, and architectural rabbit holes. I enjoy understanding how things work under the hood and occasionally over-engineering side projects for fun

The Librarian Analogy: DNS as a Reference Hunt

Imagine you walk into a massive library looking for a specific book: "The History of example.com." You don't know where it is, so you ask for help.

You check your notebook first. Maybe you wrote down the shelf location last time. Nope, nothing there.

You check the library's card catalog. Still nothing—this book isn't indexed locally.

You approach the reference librarian (your ISP's recursive resolver). They don't know where the book is either, but they're really good at finding answers. So they start making calls.

They call the head librarian (root nameserver): "Do you know where books about .com domains are stored?"
Head librarian: "I don't have that book, but try the Commercial Books wing. Here's their number."

They call the Commercial Books wing (TLD nameserver): "Do you have 'The History of example.com'?"
Wing supervisor: "We don't store that, but the Example.com Collection does. Call them directly."

They call the Example.com Collection (authoritative nameserver): "Where's 'The History of example.com'?"
Collection curator: "Shelf 192, Row 0, Section 2, Position 1."

The reference librarian writes this down (caches it for future requests), hands you the location, and you walk straight to the book.

Total time? About as long as it takes to brew coffee.

Now let's get technical.


The Journey: How DNS Resolution Actually Works

Think of DNS resolution like asking for directions in a foreign city. You don't go straight to the street address—you ask someone local, who points you to a district, who points you to a neighborhood, until you finally get the exact door number.

Here's the actual flow when you type subdomain.domain.com:

Phase 1: Local Resolution (Your Computer)

Browser cache check. Your browser looks for subdomain.domain.com in its own cache. Miss.

OS cache check. Your operating system checks its DNS cache. Miss again.

Phase 2: The Recursive Quest (The Server Hierarchy)

Your query now leaves your machine and hits your ISP's recursive resolver (or Google's 8.8.8.8, Cloudflare's 1.1.1.1, etc.). This server becomes your librarian—it's responsible for finding the answer.

The recursive resolver performs what's called "The Iterative Walk"—a step-by-step hunt through the DNS hierarchy:

  1. Query the Root Server: "Where's .com?"
    Root server responds: "Ask the .com TLD servers at these addresses."

  2. Query the TLD Server: "Where's domain.com?"
    TLD server responds: "Ask ns1.domain.com (the authoritative server)."

  3. Query the Authoritative Server: "What's the IP for subdomain.domain.com?"
    Authoritative server responds: "192.0.2.1"

  4. Cache and Return: The recursive resolver caches this answer (based on TTL) and sends it back to your browser.

  5. Browser loads the page. Your browser caches the IP (often ignoring the TTL) and connects to 192.0.2.1.

Total time? Usually under 100ms.


The Cast: Four Types of DNS Servers

1. Recursive Resolvers – Your Personal Assistant

This is usually your ISP's DNS server (or Google's 8.8.8.8 if you've manually switched). It's called "recursive" because it does all the legwork for you—asking question after question until it finds the answer.

Here's the thing: most of us default to our ISP's recursive resolver without even knowing it. In my case, my ISP just forwards everything to Google's public resolver anyway. So much for "local."

Why use the ISP's resolver instead of your browser doing the work?

  • Caching. The ISP manages a shared cache across thousands of users. If someone nearby already looked up example.com, you get the answer instantly.

  • Traffic reduction. Fewer redundant queries means less global DNS traffic.

But there's a catch—your ISP sees every single domain you visit. More on that later.

2. Root Nameservers – The Gatekeepers

There are exactly 13 root nameservers worldwide (labeled A through M). These don't resolve your domain directly—they just point you in the right direction based on the suffix.

You ask: "Where's .com?"
They say: "Ask the .com TLD servers."

Root servers store:

  • NS records (pointers to TLD servers)

  • A and AAAA records (to avoid circular dependency issues—smart)

  • DS records for DNSSEC (security stuff, like a "chain of trust")

3. TLD Nameservers – The Specialists

These handle specific top-level domains like .com, .org, or country codes like .jp or .uk.

Ask the .com TLD server: "Where's example.com?"
It points you to the authoritative nameserver for that domain.

They also use NS, A, AAAA, and DS records—same security measures as root servers.

4. Authoritative Nameservers – The Final Answer

This is where your domain provider (GoDaddy, Cloudflare, whoever) lives. The authoritative server knows the exact IP address for example.com.

It returns an A record (IPv4) or AAAA record (IPv6), and boom—you've got your answer.


Why Your ISP Is Your Default Recursive Resolver (And Why That Matters)

You might wonder: Why doesn't my browser just do all this?

Two reasons:

  1. Caching efficiency. Your browser serves one person. Your ISP's resolver serves thousands. Shared cache = faster lookups.

  2. Global traffic reduction. If every browser independently queried DNS, the internet would collapse under the weight of redundant requests.

But here's the uncomfortable truth: your ISP sees every domain you query. They know when you visit reddit.com, stackoverflow.com, or that weird niche forum you don't want anyone knowing about.

Can You Escape This?

Kind of. You can:

  • Switch to encrypted DNS (DoH or DoT) via providers like Cloudflare (1.1.1.1) or Quad9

  • Use a VPN (shifts trust from ISP to VPN provider—pick wisely)

  • Run your own recursive resolver (overkill, but possible)

But regulation? Minimal. You're trusting your ISP (or Google, or Cloudflare) by default.


Open Questions I'm Still Chewing On

  • How do you defend against your own ISP? Encrypted DNS helps, but it's not foolproof.

  • Why should you trust your DNS provider? You probably shouldn't blindly. Read their privacy policies. Switch if uncomfortable.

  • What happens if the authoritative server lies? This is where DNSSEC comes in—cryptographic signatures prove the answer is legit.


These insights continue to shape how I think about internet infrastructure. If you've never questioned what happens between typing a URL and seeing a webpage, it's worth the rabbit hole.


The takeaway: DNS is a trust game played across four server types, two local caches, and your ISP watching every move. Understanding the chain helps you make better choices about privacy and performance.