Skip to main content

Command Palette

Search for a command to run...

How DNS Resolution Works

Published
3 min read

DNS Resolution Works —>

1. What is DNS and Why Name Resolution Exists?

Computers communicate via IP addresses (like 142.250.190.46), but humans communicate via names (google.com). DNS (Domain Name System) is the internet's translator. Name Resolution is the process of navigating the internet’s phonebook to find the number that matches the name. Without it, you’d have to memorize hundreds of random numbers just to check your email.

2. What is the dig Command?

dig is a diagnostic tool used to "peek" at the DNS resolution process. Unlike a browser, which just gives you the final website, dig shows you the raw data, the status codes, and exactly which server provided the answer. It’s the "X-ray" for the internet.

3. Understanding dig . NS (The Root Name Servers)

The journey starts at the Root. The Root doesn't know the IP of google.com, but it knows where all the .com servers are.

  • The Command: dig . NS

  • What it shows: A list of 13 root server clusters (a.root-servers.net, etc.).

  • The Role: They are the "Master Directory" for the entire internet.

4. Understanding dig com NS (The TLD Name Servers)

The Root points you to the TLD (Top-Level Domain) servers. These servers manage extensions like .com, .org, or .net.

  • The Command: dig com NS

  • What it shows: Servers like a.gtld-servers.net.

  • The Role: They manage the specific registry for all commercial (.com) websites.

5. Understanding dig google.com NS (Authoritative Name Servers)

The TLD server points you to the Authoritative Name Servers. These are the final authority for a specific domain.

  • The Command: dig google.com NS

  • What it shows: Google’s own servers, like ns1.google.com.

  • The Role: These servers hold the actual records (A, MX, TXT) that the owner has set.

6. Understanding dig google.com (The Final IP)

When you run the standard command, you get the final answer: the A Record.

  • The Command: dig google.com

  • What it shows: The IP address 142.250.190.46.

  • The Role: This is the destination your browser needs to load the site.

7. How Recursive Resolvers Work Behind the Scenes

In reality, your computer doesn't run these commands. A Recursive Resolver (like Cloudflare's 1.1.1.1) does it for you.

  • It asks the Root, then the TLD, then the Authoritative server.

  • It then caches (saves) the answer so the next person who asks gets the IP instantly without repeating the journey.

8. Connecting dig to Real-World Requests

When you use dig, you are manually doing what your browser does in milliseconds.

  • If dig google.com fails but dig google.com NS works, you know the server is fine but the A Record is wrong.

  • If dig com NS fails, there is a massive issue with the global TLD registry.

Summary Table :-

StepCommandLevelPurpose
1dig . NSRootFind the master list
2dig com NSTLDFind the .com managers
3dig google.com NSAuthoritativeFind the domain's owner
4dig google.comAnswerFind the actual IP address