Skip to main content

Command Palette

Search for a command to run...

How DNS Resolution Works

Published
3 min readView as Markdown

What is DNS

DNS means Domain Name System.It is also called the internet’s phonebook.in very simple words,It is the system that translates website names or human-readable names like(chaicode.com) into machine-readable IP addresses like(192.1.1.1).Our computers dont understand names like google.com chaicode.com they only understand IP addresses.So DNS helps to convert a human-readable names into machine-freindly IP addresses.

Why Name Resolution exists

DNS name resolution exists to minimise the gap between human-friendly domain name and machine-readable IP addresses.for example

Imagine you have to remember this

192.1.1.1

Instead of this:

google.com

That would be very difficult.We humans can’t remember that jibrish thing.This is why DNS exists.

In Simple words:

  • When humans type websites name like google.com

  • Computers can’t understand that,they only understand IP addresses like 192.1.1.1.

That’s why name resolution exists because the DNS name resolution converts the name into IP addresses.

What is the dig command and when it is used

dig stands for Domain Information Groper.It is a command-line tool used to find DNS details of a domain name such as:

  • IP Address

  • Name Servers

  • Mail Servers

  • DNS records

For Example:

dig chaicode.com
//note - if you are Windows users use nslookup command instead of dig.

This command shows:

  1. Which Server(ISP) is responding

  2. The IP address of chaicode.com

  3. Query Time

Understanding dig . NS and root name servers

  • dig .NS → asks the root server for their NS(Name Server) Records

  • Root Server → They are the top level server that starts the DNS resolution process

  • They dont have the IP address of every website but they know where the TLD servers are.

Understanding dig com NS and TLD name servers

  • dig com NS → asks .com TLD servers for thier NS records.

  • TLD servers like(.com,.org) knows which authorative servers handles IP addresses of these specific websites.

  • Basic Flow:

Understanding dig google.comNS and authoritative name servers

  • dig google.com NS → It shows authorative NS server for google.com.

  • Authorative name servers are the servers that knows the actual IP address of a domain.

In Simple Words:

  1. dig google.com NS → finds which server knows the real IP of google.

  2. Authorative Server → are the server that actually have the IP address of google.com

Understanding dig google.com and the full DNS resolution flow

When You type google.com in your browser

  1. Your computer → send a query to local DNS resolver.

  2. Resolver → Asks Root Server → Who handles .com

  3. Root server → replies I dont know who handles it but i know where the .com TLD servers are

  4. Root server → asks .com TLD server → It also does’nt know the exact IP → but it knows which authoritative server handles googe.com.

  5. Root server → now asks Authoritative ns server → and it gets the IP

  6. Resolver → returns IP back to your computer → and the browser connects

  7. Example: If you run dig/nslookup google.com command in your cmd then you get this output


Non-authoritative answer:
Name:    google.com
Addresses:  2404:6800:4002:804::200e //IPv6 address
          142.250.67.78 //IPv4 address

More from this blog

Vishal's Blog

7 posts

The Actual Workflow of DNS