# Understanding DNS Resolution

# DNS : The Internet’s Phonebook

DNS (Domain Name System) exists to solve a simple problem:  
**computers understand IP addresses, but humans remember names**.

For example:

* Humans type [`google.com`](http://google.com)
    
* Computers need something like `142.250.190.14`
    

DNS is the system that **translates domain names into IP addresses**. This process is called **name resolution**.

Without DNS, we would have to remember numeric IP addresses for every website we visit. DNS acts like the **phonebook of the internet**, mapping names to numbers.

## Why Name Resolution Exists

Name resolution exists because:

* Domain names are easy for humans to remember
    
* IP addresses are required for network communication
    
* IP addresses can change, but domain names usually do not
    

DNS allows websites to move servers or change infrastructure **without users noticing**, which is critical for scalability and system design.

![Overview of DNS and DNS Records | Linode Docs](https://www.linode.com/docs/guides/dns-overview/1330-dnsoverview.jpg align="center")

---

# What Is the `dig` Command?

`dig` stands for **Domain Information Groper**.

It is a command-line tool used to:

* Query DNS servers directly
    
* Inspect DNS records
    
* Debug DNS issues
    
* Understand how DNS resolution works behind the scenes
    

While browsers perform DNS resolution automatically, `dig` allows us to **see each step explicitly**.

---

# DNS Resolution Happens in Layers

DNS resolution is hierarchical. It happens in layers:

1. **Root name servers**
    
2. **Top-Level Domain (TLD) name servers**
    
3. **Authoritative name servers**
    

Each layer knows **only part of the answer** and points to the next layer.

![Understanding DNS Technology](https://res.cloudinary.com/hy4kyit2a/f_auto,fl_lossy,q_70/learn/modules/domain-name-system-security/get-to-know-dns-technology/images/e2646f50e94fe39de4316eb5e0da9a37_kix.r8atogi14ery.png align="center")

---

## `dig . NS` — Root Name Servers

**<mark>dig . NS</mark>**

This query asks:

> “Who manages the root of the DNS system?”

### What this means:

* The dot (`.`) represents the **DNS root**
    
* The output lists **root name servers** (like [`a.root-servers.net`](http://a.root-servers.net))
    

### Why this matters:

* Root servers do not know IP addresses for websites
    
* They only know **where TLD name servers are**
    
* They are the starting point of all DNS resolution
    

Think of root servers as **the master directory of the internet**.

---

## `dig com NS` — TLD Name Servers

**<mark>dig </mark>** [**<mark>google.com</mark>**](http://google.com) **<mark>NS</mark>**

his query asks:

> “Who is authoritative for [`google.com`](http://google.com)?”

### What this means:

* The response shows **Google’s authoritative name servers**
    
* These servers store the **actual DNS records** for the domain
    

### Why this matters:

* Authoritative servers give **final, trusted answers**
    
* They know A, AAAA, MX, TXT, and other records
    

At this point, DNS resolution has reached the source of truth.

---

## `dig` [`google.com`](http://google.com) — Full DNS Resolution Flow

<mark>dig </mark> [<mark>google.com</mark>](http://google.com)

This query asks:

> “What is the IP address for [google.com](http://google.com)?”

### Behind the scenes, this happens:

1. The resolver checks its **cache**
    
2. If not found, it queries a **root server**
    
3. Root server responds with `.com` name servers
    
4. Resolver queries a **.com TLD server**
    
5. TLD server responds with Google’s authoritative servers
    
6. Resolver queries the **authoritative server**
    
7. The IP address is returned and cached
    

All of this usually happens in **milliseconds**.

The `dig` output usually shows the **final answer**, but all these steps happen automatically unless cached.

![Explaining DNS Resolution. DNS resolution, or Domain Name System… | by  soulaimaneyahya | Medium](https://miro.medium.com/1*goSb1oow5UBNF3KkzvOX8A.png align="left")

---

## Role of NS Records in DNS

**NS (Name Server) records** define:

* Who is responsible for a domain or zone
    
* Where DNS queries should be sent next
    

Every level of DNS relies on NS records:

* Root → TLD
    
* TLD → Domain
    
* Domain → Subdomains
    

Without NS records, DNS delegation would not work.

## Role of Recursive Resolvers in Real Systems

Recursive resolvers are used by:

* Operating systems
    
* Browsers
    
* ISPs
    
* Cloud providers
    

Their responsibilities include:

* Performing DNS resolution on behalf of users
    
* Following the DNS hierarchy correctly
    
* Caching results to improve speed
    
* Reducing load on root and TLD servers
    

From a system-design perspective, recursive resolvers are **critical performance components**.

![DNS as a Distributed System. Domain Name System (DNS) is often just… | by  Pratiyush Prakash | Jan, 2026 | Dev Genius](https://miro.medium.com/1*8J8BEGmh941Q-39sFjIzvg.jpeg align="left")

---

## Connecting `dig` to Real Browser Requests

When you type [`google.com`](http://google.com) into a browser:

* The browser does not contact root servers directly
    
* It asks a recursive resolver
    
* The resolver performs the full lookup
    
* The browser receives an IP address
    
* A TCP/TLS connection is established
    

DNS resolution is the **first dependency** of almost every internet request.

`dig` simply makes this **invisible process visible**, which is why it is a powerful learning and debugging tool.

---

## Why This Matters in System Design

Understanding DNS helps you:

* Design reliable services
    
* Debug production issues
    
* Configure global systems
    
* Reason about latency and failures
    

DNS is not just a networking concept - it is a **core infrastructure dependency**.

---

## Conclusion

* DNS translates human-readable domain names into IP addresses that computers can use
    
* Name resolution exists to keep the internet flexible, scalable, and easy to use
    
* DNS resolution happens in layers: **root → TLD → authoritative name servers**
    
* **NS records** define delegation and determine which servers are responsible at each layer
    
* The `dig` command helps visualize and debug each step of DNS resolution
    
* Recursive resolvers perform these lookups behind the scenes and cache results
    
* Browsers rely on this process to locate servers before any web request is made
    
* Understanding DNS resolution is essential for troubleshooting, system design, and reliable internet services
    

---

I hope you found this article helpful. If you have any questions or feedback, please feel free to leave a comment below. If you found this article valuable, please like and share it.
