Skip to main content

Command Palette

Search for a command to run...

DNS Resolution

How DNS Resolution works?

Updated
4 min read
DNS Resolution

Let’s understand DNS first.
DNS stands for the Domain Name System. It is a protocol to resolve the DNS queries.

DNS exists in the first place because of two reasons:

  1. Humans understand text better than just numbers, like blog.yogeshkumar. site and

  2. Computers are good at numbers. 76.76.21.21 is an IP Address for www.yogeshkumar.site

  3. The IP Addresses can change for any reason, like Vercel decides to move the site from one server to another.

As you can see, DNS is basically a phone book for the IP addresses with their names attached to it, which helps both computers and humans to co-exist on the internet and talk to each other with the help of the URL.

dig <domain name> is the command to get a peek inside the DNS for a domain name. It is used to query the DNS for a domain name. dig stand Domain Information Groper. It can help see the DNS resolution at various stages.

dig gives a brief overview of the DNS, what is happening under the hood when it blog.yogeshkumar.site is typed in the browser and the hashnode blog page loads. But how we reach here.

Actually, much more complex than this and let’s uncover the process of the DNS Resolution because it is not as easy as it appears that when something is entered in the browser and puff, the webpage opens up. Let me try to simplify it for you.

In short, when I am typing blog.yogeshkumar.site for the first time in my browser, there is a DNS query that happens, which is usually resolved by the ISP with a recursive DNS resolver and before our local caches of the browser, os, and router are contacted, so that it can be resolved asap.

Let’s assume I'm going to blog.yogeshkumar.site (here I will refer to it as my blog) for the first time. The recursive DNS resolver doesn’t have the IP address of the blog, so it first contacts the root servers to find the location of the .site Top Level Domain(TLD).

These are all the root servers, listed

The servers that hold .site domains are listed below.

Once the DNS query is resolved for the top-level domain, the TLD servers are queried by the Recursive DNS Resolver for the location (A Record / IP Address are interchangeable here) of the yogeshkumar. site with the TLD servers, and once they indicate which IP address redirects it to the Domain Name Servers, which actually hold the accurate IP address of where the domain is located (in this case, Cloudflare DNS and Namecheap is my registrar here).

Once the A record for yogeshkumar.site is found by the Recursive DNS Resolver, NameCheap servers are queried for blog.yogeshkumar.site, which is a CNAME (Canonical Name/Alias) for the hasnode.network (Authoritative Name Server) here and then the query is resolved, and the data is sent to recusive DNS resolver at the ISP, and the browser is served the webpage of the IP address at which it is pointed.

Before moving on to summarise the process, I said “redirected” multiple times that I was referring to how that redirection happens in the DNS Domain Name System through NS records, which are basically pointers in the DNS.

In short,

That’s how our DNS query is resolved, and we visit any domain name we are trying to access, like www.google.com and blog.yogeshkumar.site, and all other websites.

I am posing an analogy here. It’s like someone sent you a post from Ahmedabad to Gurugram, once the post has been posted to the Post Office. First, they verify it for the indian address only, which means the root servers have been co/ntacted, and once they find it is for India address. Then the post officers or the post computer system finds which part of the country it is headed for, which means the TLD servers have been contacted, and then the state in the region of India, which is Haryana and then postal officers and their netowrk figure out the city like the authoritative name servers is being found out which is Gurugram here and later the block of the city and lane and further on.

That’s the browser that loads our website we see daily, and all of this happens within minutes, and we couldn’t even blink, the site is here in front of us. Onward and forward.