Skip to main content

Command Palette

Search for a command to run...

How DNS resolution works

Published
4 min read

What is DNS:-

  1. DNS stands for Domain Name System.

  2. DNS is like the internt’s phonebook.

On browser we search website like www.google.com, the computer does not understand IP addresses (i.e. numbers like 142.250.190.14)

The job of DNS is to convert the website name into IP address, so your browser can find the correct website on the internet.

What is DNS resolution?

DNS resolution is the process of converting a website names (like www.google.com) into IP address (like 142.250.195.36) so that your computer can find the correct server on the internet.

Why DNS resolution is needed?

  1. Computers don’t understand names,they only understand IP addresses.

  2. Humans don’t understand IPs,we remember names.

DNS resolution acts as a translator between humans and computers.

How DNS resolution works:-

  1. You type www.examplw.com in your browser.

  2. Browser asks as; ‘Do we already know this IP?’ (DNS cache)

  3. If not found→ os asks DNS resolver (usually ISP/router)

  4. Resolver checks:

    1. Root DNS server→ where is .com?

    2. TLD server (.com)→ where is example .com?

    3. Authoritative DNS server→here is the IP

  5. IP address is returned to your browser.

  6. Browser connects to that IP ans websites loads.

Browser→DNS resolver→Root→TLD→Authoritative→IP address

What is the dig command and when it is used?

Dig means -domain information groper is a DNS diagnostic command-line used to query DNS servers directly and display detailed information about DNS name resolution.

When it is used?

  1. When website does not open.

  2. When checking DNS configuration.

  3. After making DNS changes.

  4. By network admins/devops engineers.

Understanding dig .NS and root name servers

When you open google.com,your system asks:

“Who knows the IP address of google.com?”

DNS answer step by step , and root name servers are the starting point.

What is an NS?

An NS record tells

‘Which DNS server responsible for this domain?’

e.g.

google.com→handled by ns1.google.com, ns2.google.com

  1. NS record= authority pointer

  2. It doens’t give IP of website

  3. It tells where to ask next

What are root name servers?

Root servers are the top most DNS-servers on the internet.

Root servers only know one thing.

Which server manage each TLD (.com, .org, .in)

They do not know

  1. IP of website

  2. Website details

They only say

“Ask the .com name servers”

Understanding dig .NS command:-

dig google.com NS

What it asks:

Who are the name servers for google.com?

Understanding dig .NS

dig .NS

What it asks:

“Who manges the root of DNS?”

  1. These are 13 root name server.

  2. Distributed worldwide.

  3. Backbone of the internet.

Understanding dig com NS and TLD name servers:-

  1. What is a TLD name server?

TLD (Top level domain)= Last part of a domain name

e.g

  1. .com

  2. .org

  3. .in

  4. .net

  1. TLD name servers are responsible for:-

Knowing which authoritative name servers manage domains under them

What does dig com NS mean?

dig com NS

Meaning:-

“Who are the name servers responsible for the .com domain?

You’re directly asking the root DNS system about .com

  1. .com is managed by gltd-servers

  2. These are TLD name servers

  3. They are authoritative for .com

Why dig com NS is important?

  1. Debug domain delegation issues.

  2. Verify TLD authority.

  3. Learn DNS internals.

  4. Understand where delegation breaks.

Understanding dig google .com NS and authoritative name servers:-

What does dig google.com NS mean?

dig google.com NS

Meaning:-

“Which name servers are authoritative for google.com?”

  1. This does not ask for IP.

  2. It asks who is allowed to give final DNS answers.

  3. These servers own google.com DNS

  4. They store all records

    1. A/AAAA

    2. MX

    3. TXT

    4. CNAME

  5. These are authoritative name servers.

What is an authoritative name server?

The DNS server that contains the original zone file for a domain.

It:-

  1. Doesn’t forward queries

  2. Is the source of truth

Understanding dig google.com and the full DNS resolution flow:-

What happens when you run dig google.com

dig google.com

You are asking:

“What is the IP address of google.com and how did you figure it out?

DNS resolves this through multiple layers,

DNS resolution flow:-

  1. Step 0:-Your system starts the query

Your laptop does not directly talk to root servers

Instead, it asks a recursive resolver,

  • IPs/DNS (Airtel,Jio)

  • Or public DNS (8.8.8.8, 1.1.1.1)

Step 1:- Recursive resolver checks cache

First question:Have already resolved google.com recently?

  • If yes→ returned cached IP

  • If no → start full DNS journey

Step 2:-Ask root name server (.)

Resolver asks:

Who knows google.com?

Root replies:

‘I don’t know google.com,but .com TLD servers do.’

Step 3:-Ask .com TLD name server

Resolver asks:

‘Who manages google.com”

.com replies:

These are google.com’s name servers.

  • ns1.google.com

  • ns2.google.com

  • ……..

Step 4:-Ask authoritative name server

Resolver asks:

‘What is the IP of google.com?’

Authoritative server replies:

google.com→IP address i.e.142.xxx.xxx.xxx

Step 5:-Answer returned and cached

  • Resolver sends IP back to your system

  • Result is cached using TTL

  • Browser connects to the IP→website loads