Skip to main content

Command Palette

Search for a command to run...

How DNS Resolution Works

Published
4 min read
How DNS Resolution Works

DNS — The Internet’s Phonebook

The Domain Name System (DNS) is often called the Internet’s phonebook. It translates human-readable domain names (e.g., youtube.com) into machine-readable addresses (like 142.250.190.14). It is a decentralized, hierarchical system that allows users to navigate the web using simple names instead of remembering complex, numerical IP addresses.

youtube.com ———> 142.250.190.14

  • Just like you use a contact name (like “Mom”) instead of remembering a phone number, computers use IP addresses (like 142.250.190.14) to communicate — but humans prefer easy names like youtube.com.

Why the name “resolution" exists?

  • Human remember names, not numbers — People remember names (like youtube.com) rather than IP addresses (142.250.190.14).

  • Computer communicate using IP addresses — Computers & network devices need IP addresses to communicate with each other over the internet.

  • Flexibility & Scalability — Websites often change servers, use large infrastructure (or) scale globally. DNS allows the domain name to stay the same even if IP address changes.

  • Traffic Management — It enables smart routing, directing user to the closest server to improve the website loading speed.

  • Hierarchical & Scalable Design — DNS is distributed & hierarchical:

Root servers ——→ TLD servers (.com, .org, etc..) ——→ Authoritative Name Servers

This Design makes the internet scalable to billion of devices.

💡
There are 13 root servers & around 1,500 - 2,000 physical server instances deployed globally today.

What is dig command & when it is used?

dig (Domain Information Grouper) is a network tool to query the DNS & retrieve information about the domain names. It performs basic lookup for the A record (or) fetches other DNS records (A, MX, NS, CNAME…).

  • dig youtube.com (A record)

  • dig youtube.com NS (Name Servers)

  • dig youtube.com MX (Mail Servers)

Commonly used for:

  • Troubleshooting DNS issues.

  • Check which server is authoritative for a specific domain.

  • Verifying DNS propagation.

  • Testing Email of SPF records.

It shows:

  • The resolved IP.

  • Which server responded.

  • Query time & DNS flags.


DNS works in layers

Root servers ——→ TLD servers (.com, .org, etc..) ——→ Authoritative Name Servers

Your system’s recursive resolver handles these steps automatically behind the scene. Lets explore each layer using dig:

  1. Root Name Servers:

     dig . NS
    

What this means:

  • ." means root zone.

  • NS" represent Name Server records.

Output:

You’ll see servers like: (a ——> m = 13-root servers)

  • a.root-servers.net

  • b.root-servers.net

  • m.root-servers.net

What they do:

  • Don’t know the IP address of websites.

  • Know where to find TLD servers (.com, .org, .net).

  1. TLD Name Servers:

dig com NS

This asks: Who manages “.com" domains?

You’ll see TLD servers like -

  • a.gtld-servers.net

  • b.gtld-servers.net

What they do:

  • Know which “Authority Name Servers” handle each domain under “.com".

  • Don’t know the final IP.

  1. TLD Name Servers:

dig youtube.com NS

This asks: Who is Authoritative for “youtube.com" domains?

You’ll see NS servers like -

  • ns1.google.com

  • ns2.google.com

What they do:

  • Store actual DNS records.

  • Return final IP address.

  • Are the source of truth.

They know: google.com ——> 142.250.x.x


Full DNS resolution

dig google.com

Now your’e asking: What is the IP address for google.com?

Behind the scenes, the recursive resolver does:

  • Ask Root ——> where is .com?

  • Ask TLD ——> where is google.com?

  • Ask Authoritative ——> what is the IP?

  • Return’s answer to you (You only see the final result).

How Recursive Resolvers Work ?

Your computer generally asks your ISP DNS or 8.8.8.8 (goole-DNS).

The recursive resolver:

  • Performs the full lookup chain.

  • Cache results.

  • Returns the IP.

This improves:

  • Speed.

  • Scalability.

  • Performance.


🧠 What are NS Records & Why They Matter?

  • NS = Name Server record.

  • It tells the world: These servers are responsible for this domain.

  • Example: google.com's NS \=== ns1.google.com

  • Without NS records: No one would know where to find your domain’s DNS records


🧩 Mapping dig commands to DNS stages

CommandWhat it shows
dig . NSRoot Servers
dig com NSTLD Servers for .com
dig google.com NSAuthoritative Servers for google.com
dig google.comFinal IP resolution

🌎 Real-World Browser Flow

When you type https://google.com

The browser:

  • Resolves DNS.

  • Gets IP address.

  • Establishes TCP connection.

  • Performs TLS connection.

  • Sends HTTP request.

💡
DNS is the first step in every web request.

✅ Conclusion

DNS is the invisible system that makes the internet simple and usable.

Instead of forcing us to memorize complex IP addresses, it quietly translates human-friendly domain names into machine-readable numbers — in just milliseconds.

Every time you type a website like youtube.com, DNS works behind the scenes, contacting multiple servers, finding the correct IP address, and helping your browser load the site seamlessly.

Without DNS, the internet would be complicated, confusing, and far less user-friendly.

In short, DNS is what makes the web human-friendly and scalable.

More from this blog

Syed Minhaj Hussain

16 posts