# How DNS Resolution Works

Hey Everyone, let’s understand what DNS is.

### What is DNS and why does name resolution exist?

DNS stands for Domain Name System.

Computers don’t understand domain names like www.google.com. They understand IP addresses.

On the other hand, we don’t want to remember things like:

Human-readable `www.google.com`

Machine-readable `19.20.21.2`

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1769525493703/8e605bfc-42d3-477b-840a-141dd65d9954.png align="center")

So DNS exists to solve one simple problem:

***Convert human-friendly names into machine-friendly addresses(IP addresses).***

That’s it.

It is like a phonebook:

* You search by name
    
* You get a number
    
* You make the call
    

DNS does the same thing on the Internet.

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

As DNS works in the background

There should be a tool that will help engineers to inspect and debug DNS.

That's where dig comes.

What is dig?

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

* Queries DNS directly
    
* Shows *exactly* how name resolution works
    
* is used for debugging, learning, and system analysis
    

Before running commands, we should get this clear that DNS always flows like this:

Root servers

↓

TLD servers (.com, .org, .net)

↓

Authoritative servers

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1769523300517/b12f42e2-6af2-4951-9ca4-de1a65ff0528.png align="center")

Understanding `dig . NS` and root name servers

.\[dot\] it represent the root. So that means you are asking for name servers of root server.

```bash
dig . NS
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1769530457178/8e13370e-8246-44fd-a99d-652a0d4b57ec.png align="center")

There are total 13 root servers. Some them are as above. These servers are the **starting point of all DNS lookups**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1769530515378/1b320008-274c-4d1e-b383-8e0fb80c13ca.png align="center")

Understanding `dig com NS` and TLD name servers

Now moving forward to finding the .com **TLD (Top Level Domain)**

Name servers like:

```bash
a.gtld-servers.net
b.gtld-servers.net
```

These are **TLD name servers**. They don’t know the IP address of google.com but they know the address of the authoritative server which manages google.com

Understanding `dig` [`google.com`](http://google.com) `NS` and authoritative name servers

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1769531721296/cf4ae6e6-684e-4bf9-81f8-6faf4bb79778.png align="center")

These servers are **authoritative for** [**google.com**](http://google.com)**.** They hold the *actual DNS records*

Without authoritative servers:

* DNS has no final answer
    
* Resolution cannot be completed
    

### What happens behind the scenes

It looks like a single command, but behind the scenes it looks like this:

1. Ask root servers → “Who handles .com?”
    
2. Ask .com servers → “Who handles [Google.com](http://google.com)?”
    
3. Ask Google’s authoritative servers → “What is the IP?”
    
4. Return the final answer
    

And now, you know how **DNS** really works.

Thanks for reading, and see you in the next blog!

Peace ✌️ and Happy Learning!
