# How DNS Resolution Works

## What is DNS and why name resolution exists

**DNS (Domain Name System)** is like the **phonebook of the internet**.

Humans prefer names like [`google.com`](http://google.com), but computers communicate using **IP addresses** like `142.250.190.14`.  
DNS is the system that **translates human-friendly domain names into machine-friendly IP addresses**.

If name resolution didn’t exist:

* You’d have to **memorize IP addresses** for every site
    
* Websites changing servers would **break everything**
    
* The internet would be basically unusable for normal people
    

**Name resolution bridges the gap** between human convenience

How DNS name resolution works

* You type [`example.com`](http://example.com) in your browser
    
* Your computer asks a **DNS resolver** (usually from your ISP or Google DNS)
    
* If it’s not cached, the resolver asks:
    
    * **Root DNS server** → “Where is `.com`?”
        
    * **TLD server** → “Where is [`example.com`](http://example.com)?”
        
    * **Authoritative DNS server** → “Here’s the IP”
        
* The IP address is returned
    
* Your browser connects to that IP and loads the website
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1768729145890/bb4534e3-27e8-4b86-b2d2-2ce6a2a8a2de.jpeg align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1768729178938/904e9d97-a8cd-41f3-acfa-548bdb542f9a.jpeg align="center")

## What is the dig command and when it is used

`dig` (Domain Information Groper) is a **command-line DNS lookup tool** used to **query DNS servers directly** and inspect how **DNS name resolution** works.

Why `dig` exists

Browsers and OS DNS lookups hide a lot of details.  
`dig` shows **everything**, making it perfect for **debugging, learning, and verification**.

You use `dig` when you need:

* **Precise DNS answers**
    
* **Troubleshooting DNS issues**
    
* **Security & validation**
    
* **Learning how DNS really works**
    

A typical `dig` output includes:

* **QUESTION SECTION** → What you asked
    
* **ANSWER SECTION** → The DNS response
    
* **AUTHORITY SECTION** → Which DNS servers are authoritative
    
* **ADDITIONAL SECTION** → Extra helpful data
    
* **Query time** → How fast DNS replied
    
* **SERVER** → Which DNS server answered
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1769786721407/bcaf2a4e-c107-45d3-b156-2f5134259aed.webp align="center")

## Understanding dig . NS and root name servers

let’s connect the dots between `dig`, **NS records**, and **root name servers** — this is where DNS stops being magic and starts making sense.

1. Understanding `dig`
    
    `dig` asks **DNS servers questions** and shows you **exactly how they answer**.
    
2. What does `NS` mean in `dig`?
    
    NS = **Name Server**
    
    These servers are responsible for answering DNS questions for this domain.
    
3. The DNS hierarchy
    
    ```bash
                    (Root .)
                       |
                    (.com)
                       |
                  (google.com)
                       |
                 (www.google.com)
    ```
    
    4. Root name servers (the top of DNS)
        
        **Root name servers** sit at the **very top of DNS**.
        
        Who is responsible for this TLD (`.com`, `.org`, `.in`, etc.)?
        

## Understanding dig com NS and TLD name servers

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1768729220258/165f088a-1262-4ff3-9e60-2d392e8b4f65.jpeg align="center")
