# How DNS Resolution Works

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

* We type names like google.com
    
* Computers need numbers like 142.250.564.548
    

DNS exists to convert names into IP addresses. This process is called name resolution.

## Why Name Resolution Exists

Computers are bad at remembering names. Humans are bad at remembering numbers. So DNS acts as a translator between humans and machines.

Name resolution = “Find the IP address for this domain name.”

That’s it. That’s the core problem DNS solves.

### What is the dig Command?

dig stands for Domain Information Groper. It is a command-line tool used to :-

* Check DNS records
    
* Understand how DNS resolution is happening
    
* Debug DNS-related issues
    

Web developers and system engineers use dig when :-

* A site is not loading
    
* DNS changes are not working
    
* They want to see what DNS servers are involved
    

### DNS Works in Layers

DNS resolution does **not** happen in one step. It happens in **layers**, like asking for directions :-

1. Root name servers
    
2. TLD name servers (.com, .org, etc.)
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1769842528759/c9f03654-3679-4f56-b6a9-4074a2919d3f.png align="center")

Let’s walk through these layers using dig.

### dig and .NS Root Name Servers

Root servers:

* Sit at the top of DNS hierarchy
    
* Don’t know IP addresses of websites
    
* Only know who manages TLDs like .com, .org
    

### dig google.com NS Authoritative Name Servers

* They are owned by Google (or their DNS provider)
    
* Store the actual DNS records
    
* Give the final trusted answers
    

### dig google.com - Full DNS Resolution

This gives the final answer :

* IP address (A / AAAA record)
    
* TTL (cache time)
    
* Confirmation from authoritative server
    

This is exactly what your browser needs to connect to Google’s servers and load the page.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1769846910444/5b26af29-4d00-478e-b7b0-87df4eb06f0b.png align="center")

Thanks for reading 🙌  
Keep learning, one layer at a time 🚀
