Skip to main content

Command Palette

Search for a command to run...

How DNS Resolution Works

Basic Commands

Published
•7 min read•View as Markdown
How DNS Resolution Works

What is DNS and why name resolution exists .

  • First, let’s understand what DNS is. Then it will be easier to understand how DNS resolution works.

  • DNS (Domain Name System) gives a unique name to a website’s IP address. Every website has a unique IP address, but remembering IP addresses is very difficult for users.

  • That’s why DNS is used. It hides the IP address and provides an easy-to-remember domain name. When a user searches that domain name in a browser, the browser loads the website whose IP address is linked to that domain name.

Phonebook of Internet .

  1. Just like we save phone numbers in our mobile under a person’s name (family, friends, or anyone else) because it is hard to remember numbers, computers also work in a similar way.

  2. Every device on the internet is given an IP address to uniquely identify it. But an IP address is like a phone number—it is even more difficult to remember.

DNS Resolution work .

  • DNS resolution is the process of converting a website name into an IP address so that your browser can find the correct server on the internet.

  • This is a long process, so let’s understand it step by step.

💡
Above is a DNS Hierarchy a step by step guide a DNS find a IP Address for your website. I wrote steps and giving a name in a sequence.
  • DNS important key terms .

  • De-Centralized :- DNS does not depend on one single computer or server to work. DNS is spread across many servers all over the world.

  • Delegation :- Handing over the responsibility of a domain (or subdomain) to another DNS server.

  • Loose Coupling :- Each DNS level works independently and does not depend on internal details of other DNS servers.

What is dig command and when it use .

  • dig stands for Domain Information Groper. It is used to ask DNS questions and see the answers clearly in your where you are put that command .

  • Obviously this command is used by a developer or programmer , A normal user usually does not know about this command. Even if they know, they do not really need to use it. Below, I have explained a few steps that show why the dig command is used.

  1. This command is basically used in the Mac or Linux terminal when a user wants to get information about a domain name.

  2. For example, it can be used to find the A record, check which DNS server the domain is using, see how many name servers are there, find the CNAME record, and understand how DNS works.

  3. It also helps to know where the main DNS servers are, which IP addresses they use, and how different name servers are connected to each other.

dig https://google.com +short

- This dig command to look up the "A" record for the domain name `Google`.
- Return give back a IP address of `google.com` `142.250.193.142`.

Understand dig . NS and Root name server .

  • The dig command is used to search for a domain.

  • The dot (.) refers to the root server, which means the query first goes to the root server.

  • The root server then helps find the name server for the domain.

  • A name server works like a nickname system — it checks which IP address the domain is connected to.

  1. The job of Root Server is only that the first find your TLD domain in our server like { .com, .org } , means all Top level domain.

  2. There are total 13 root server from A - M.

  • Nameserver :- A Nameserver is a type of DNS Server. It is the server that store all DNS Record for a Domain, including A Record , MX Record, or CNAME.

Understanding dig com NS with TLD Nameserver .

  • dig command is for finding a in-depth information about your given URL.

  • TLD :- It is a Top level Domain like { .com, .net, .org, .in, .edu }. Hope you understand .

  • So understand first why all DNS server find your TLD , because the reason is that TLD know where is you actual IP Address store mean your A Record of your site . They don’t know your IP but they know who manage name-server manage your IP address.

  • Basically Authoritative name server where is store your request domain name IP Address.

  • Once they IP got from Authoritative name server they job done , then they go back to DNS Resolver give him to IP Address and the DNS Resolver return that IP Address to Browser , and then the last step your request website load all web pages.

Understanding dig google.com NS and Authoritative name-server .

When you are run this command dig google.com ns they give back you list of how many nameserver configure to your main Domain name { In Simple you can also say how many nickname have you main Domain name } .

  1. When you type this command in terminal

  2.  dig google.com ns
    

    They give back you output which name server is responsible for my google.com domain.

  3.  google.com.             125053  IN      NS      ns2.google.com.
     google.com.             125053  IN      NS      ns3.google.com.
     google.com.             125053  IN      NS      ns1.google.com.
     google.com.             125053  IN      NS      ns4.google.com.
    
  4. 125053 :- It is a TTL { Time to live } means how much long time for your DNS IP Address store in cache .

  5. In :- Internet class

  6. Ns :- Nameserver record type.

  7. ns2.google.com. :- the nameserver for google.com

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

  • This command dig google.com is only used for when we want a direct A record of the domain name . Because A record is the main IP Address of the website .

  • Now if you want to find it in the terminal with the help of dig command , you just type a …

  •   dig google.com
    
  • And then you got a A Record of your request URL.

  •   google.com.             110     IN      A       142.250.194.238
    
      Query time: 194 msec
      SERVER: 10.255.255.254#53(10.255.255.254) (UDP)
      WHEN: Tue Jan 27 13:57:03 UTC 2026
      MSG SIZE  rcvd: 55
    

The Full DNS Resolution flow .

  1. At the first you put the URL in the browser input field , Browser needs an IP address to connect to the server. So here the DNS resolution flow start.

  2. They first check in cache if i know about it your IP address or not , if they got IP in the cache they return back and load you website , if the IP address not found the here the flow start .

  3. They go to then DNS Resolver . And at the first check your TLD into the Root Server because they know about where you all nameserver store give Domain name .

  4. Root Server sent back the response with TLD server . Then it check the nameserver and figure who is the Authoritative Nameserver , because all the A Record store there , it is manage by ISP { Internet Service Provider .

  5. DNS Resolver now got who is the Authoritative nameserver now they ask for IP Address.

  6. Authoritative nameserver give back the IP Address to the DNS Resolver .

  7. Now DNS Resolver got the A Record or IP Address they sent Response to back browser with IP Address .

  8. Then the final step is that browser have a IP Address know they load you website .

  9. So this is the whole process how you DNS Resolution flow work.

💡
So this is all about some basic DNS find commands and some of about how you DNS query work form start to end { means how DNS resolution work } . Hope you will understand