How DNS Works Internally: From Browser to Server

In Part 1, we understood:

  • What DNS is
  • Why DNS exists
  • How DNS connects domain names to IP addresses

Now it is time to go one level deeper to find how dns works.

In this part, we will answer the most important question:

What actually happens behind the scenes when you type a website name in your browser?

This blog explains How DNS works internally step by step without assuming any prior networking knowledge.


The Big Question

When you type:

www.example.com

How does the internet:

  • Know where this website lives?
  • Find the correct server?
  • Do it in milliseconds?

To understand this, we must first understand the DNS hierarchy.


The DNS Hierarchy (Foundation of DNS)

DNS is designed as a hierarchical system similar to a government structure.

It has multiple levels each with a specific responsibility.

The 4 Main DNS Levels

  1. Root DNS Servers
  2. TLD (Top-Level Domain) Servers
  3. Authoritative DNS Servers
  4. DNS Records (A, CNAME, MX, etc.)

Let’s understand each one clearly.


1. Root DNS Servers (The Top of DNS)

Root servers are the starting point of every DNS lookup.

  • There are 13 logical root server clusters
  • Distributed globally
  • Managed by trusted organizations

Their job is very simple:

Root servers do NOT know website IPs.
They only know where TLD servers are.

Example:

  • Root server knows where .com, .in, .org servers are
  • It redirects the query to the correct TLD

2. TLD Servers (Top-Level Domain Servers)

TLD servers manage extensions like:

  • .com
  • .in
  • .org
  • .net

Their responsibility:

TLD servers know which authoritative DNS server controls a domain.

Example:
For example.com:

  • Root → sends to .com TLD
  • .com TLD → says:
    “The authoritative DNS for example.com is here”

TLD servers still do not know the IP address of the website.


3. Authoritative DNS Servers (The Boss of Your Domain)

Authoritative DNS servers are where actual DNS records live.

These servers:

  • Store A, CNAME, MX, TXT records
  • Provide final answers
  • Are controlled by DNS providers like:
    • Cloudflare
    • AWS Route 53
    • GoDaddy
    • Namecheap

When a DNS query reaches this level:

  • The correct IP address is returned
  • The DNS lookup is complete

4. DNS Records (Actual Mapping)

DNS records are simple instructions stored inside the authoritative server.

Example:

A record: example.com → 93.184.216.34
CNAME: www → example.com
MX: mail server
TXT: verification data

These records tell the internet:

  • Where the website lives
  • Where emails should go
  • Who owns the domain

Step-by-Step: What Happens When You Type a Website

Now let’s connect everything together.

Step 1: Browser Cache Check

Your browser first checks:

  • “Do I already know this IP?”

If yes → website loads instantly
If no → move to next step


Step 2: Operating System Cache

Your OS checks its local DNS cache.

If found → IP returned
If not → continue


Step 3: DNS Resolver (ISP or Public DNS)

Your system sends the query to a DNS resolver, usually provided by:

  • Your ISP
  • Google DNS (8.8.8.8)
  • Cloudflare DNS (1.1.1.1)

This resolver performs the full DNS lookup on your behalf.


Step 4: Resolver Queries Root Server

The resolver asks:

“Where can I find information about this domain?”

Root server replies:

“Ask the TLD server.”


Step 5: Resolver Queries TLD Server

The resolver asks the TLD server:

“Who manages this domain?”

TLD replies:

“Here is the authoritative DNS server.”


Step 6: Resolver Queries Authoritative Server

The resolver finally asks:

“What is the IP address of this domain?”

Authoritative server responds with:

93.184.216.34

Step 7: IP Returned to Browser

The resolver sends the IP back to:

  • Your OS
  • Your browser

Your browser then connects to the server using that IP.

It work is done here.


DNS Caching (Why DNS Is Fast)

DNS would be very slow if this process happened every time.

That’s why caching exists.

Where DNS Is Cached:

  • Browser
  • Operating system
  • Router
  • ISP resolver
  • Public DNS servers

Each DNS record has a value called TTL (Time To Live).

Example:

TTL = 300 seconds

Meaning:

  • Cache DNS response for 5 minutes
  • After that, ask again

Caching is why websites load quickly after the first visit.


Important Clarification

DNS does NOT load website content.

DNS only:

  • Finds the server IP

After that:

  • HTTP/HTTPS takes over
  • Server sends HTML, CSS, JS, images

DNS and web traffic are separate processes.


What Happens If DNS Fails?

If DNS fails:

  • Website won’t open
  • Email won’t be delivered
  • APIs will stop responding

That’s why:

  • DNS reliability is critical
  • DNS providers use global infrastructure
  • Multiple nameservers are mandatory

Summary of Part 2

In this part, you learned:

  • DNS hierarchy and structure
  • Role of root, TLD, and authoritative servers
  • Step-by-step DNS resolution flow
  • How caching makes DNS fast
  • What DNS does and does NOT do

You now understand how DNS works internally.

part 1 – https://insightclouds.in/what-is-dns/


What’s Coming in Part 3

In Part 3, we will cover advanced and practical topics:

  • DNS records explained (A, AAAA, CNAME, MX, TXT, NS, SOA)
  • DNS propagation and TTL
  • Nameservers and domain control
  • DNS security basics (DNSSEC)
  • Common DNS mistakes and best practices

Part 3 will turn you from beginner to confident DNS user.

Next Steps :

Devops tutorial :https://www.youtube.com/embed/6pdCcXEh-kw?si=c-aaCzvTeD2mH3Gv

Follow our DevOps tutorials

Explore more DevOps engineer career guides

Subscribe to InsightClouds for weekly updates



Comments

Leave a Reply

Your email address will not be published. Required fields are marked *