# DNS Resolution

### What is DNS resolution ?

(DNS = Phone book of internet)  
The Problem is computer do not understand the names like

```css
nitishkumar.cloud
cahicode.com
```

Computers only understand Ip address

### Then DNS comes to picture

imagine you have to remember phone number of all your friend it is pain !na  
DNS came to picture and simpified like remembering all phone number now you have to only  
friends name

### analogy:

| **Real Life** | **Internet** |
| --- | --- |
| Name: Nitish kuar | Domain: nitishkumar[.c](http://google.com)loud |
| Phone number | IP address:192.168.137.1 |
| Contacts app | DNS |

---

### What is DIG and When it used ?

DIG stands for Domain information Groper

It is command used to :

1. Debug the DNS
    
2. To see which server is responding
    
3. To understand full rsolution path
    
4. To check records A , MX , TXT ,etc
    

### Why engineers use dig:

* Website not opening
    
* DNS misconfigured
    
* Checking propagation
    
* Cloud / DevOps debugging
    
* Security analysis
    

**Example:**

```css
dig nitishkumar.cloud
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1769660049663/55dc944a-427c-498b-8e45-1b88c24bd6be.png align="center")

This shows:

* Which server answered
    
* What IP you got
    
* How long it took
    
* DNS flags
    

---

### DNS Hierarchy

DNS woks in layer

```css
Root (.)
   ↓
TLD (.com, .org, .in)
   ↓
Authoritative (google.com servers)
```

![dns_hierarchy](https://media.geeksforgeeks.org/wp-content/uploads/20260105180018802909/dns_hierarchy.webp align="left")

---

### `dig . NS` → Root Name Servers

### Root = Top boss

```css
dig . NS
```

> This asks:  
> Who controls the ROOT of DNS?

### Output gives:

* [a.root-servers.net](http://a.root-servers.net)
    
* [b.root-servers.net](http://b.root-servers.net)
    
* etc.
    

These are **root name servers**.

### What they do:

They do not know [google.com](http://google.com)  
for .com it go to .com TLD servers

### Real-life analogy:

Root = Country-level office  
They don’t know your house, they only know:  
Ask the Karnataka office

---

## `dig com NS` → TLD Name Servers

### TLD = .com managers

```css
dig com NS
```

This asks:  
Who manages .com domains?

They reply with:

* [a.gtld-servers.net](http://a.gtld-servers.net)
    
* [b.gtld-servers.net](http://b.gtld-servers.net)
    
* etc.
    

### What they do:

They Told  
For [google.com](http://google.com), go talk to Google’s name servers

---

## `dig` [`google.com`](http://google.com) `NS` → Authoritative Servers

Authoritative = Final Truth Source

```css
dig google.com NS
```

This gives:

* [ns1.google.com](http://ns1.google.com)
    
* [ns2.google.com](http://ns2.google.com)
    
* etc.
    

These are **Google’s own DNS servers**.

### What they do:

They store:

* A records (IP)
    
* MX (mail)
    
* TXT (verification)
    
* CNAME etc.
    

They are the final **source of truth** for [google.com](http://google.com).

---

## `dig` [`google.com`](http://google.com) → Full Resolution Result

This is what browser want

```css
dig google.com
```

That gives:

```css
google.com.   A   142.250.xxx.xxx
```

This is the **actual IP** your browser connects to.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1769661155391/0c1f132a-5f88-447d-8e75-5e95350d2e74.png align="center")

# (Cheat Sheet)

| Command | DNS Layer |
| --- | --- |
| `dig . NS` | Root |
| `dig com NS` | TLD |
| `dig` [`google.com`](http://google.com) `NS` | Authoritative |
| `dig` [`google.com`](http://google.com) | Final IP |
| Browser request | Uses IP |

credits:

[https://www.geeksforgeeks.org/computer-networks/domain-name-system-dns-in-application-layer/](https://www.geeksforgeeks.org/computer-networks/domain-name-system-dns-in-application-layer/)

[https://www.ibm.com/think/topics/dns](https://www.ibm.com/think/topics/dns)
