DNS-Domain Name Service this is one of the most interesting topic when it comes to networking and connection have you ever wondered how so domain have names while hardware can understand only numbers how is that you click example.com and voila the website appears right in front of you , Why names are used instead of IP ??
Well the answer is simple it’s because it is Humanly readable and can be easily remembered that’s it!! You cannot remember 127.0.03.10 a number like this can you that too this is just of a single server.
So before jumping to how the DNS resolution works lets first understand what it conatains.
if you would have noticed when you search example.com you type two word what are these and there any hidden domains added to it
for example.com it might be example.com.
The DNS server reads backward like this:
Let’s try to unserstand by example what happens here .Suppose you want to visit a website say example.com (personal favourite) when you click enter the request goes to the DNS servers(this are static and doesn’t not change unless required) these servers recieve your request and checks if they have that IP of that domain listed in their directory(maintains a frequently visited website list) a.k.a DNS resolver cache(temporarily store the IP until the ttl has ended) and if it is avaliable then it sends it back to the browser else a process starts the request is then sent to a Recursive DNS server or the root server what this does is recursively tries to find the Top level Domain(TLD) of the requested server (.com,.org,.in,.dev..etc are some common top level domains) now for this example it is .com so the Recursive DNS server sends the request to that TLD , Now the TLD checks the request and send it to a Authoritative DNS Server which has the IP of the requested server example.com the IP is then sent directly to your browser through your IP address present in the Headers of the request. Then your Browser request it to the given IP and you website appears.
This might feels like a long process but it all depends on the networking speed of your device and your network . So , the next time you try to browse a website remember this is the process your request has to go through. All though it’s speed is negligible sometimes it can lag up.
You can also check that out using a dig command. Which is avaliable in Linux or WSL(Windows Subsystem for Linux) if you are on windows.
To check follow these steps:
sudo apt install bind9-dnsutils
dig google.com
As you can see the highlighted section is the IP address of example.com (changes overtime)
and just below that is SERVER which is the DNS server which was used to query and find the IP address and ass you can see the query time is 44 msec(average for their time but) is almost negligible to a normal human.
There are also other commands like
dig example.com NS : Shows all the Name servers it has (these servers contains which authoratative server holds the domain’s IP)
dig example.com ANY : Shows Every Record of IP address for the server example.com
dig example.com +short : shows the IP in a single line
and there are many more you can checkout
Summary,
Your request —> DNS recursive server —> Root server or TLD —> Authoratative server (has the IP) —> you browser —> requested server
This is my understanding of the DNS server and how it works.



Top comments (2)
How does DNS resolution affect website speed or reliability 🤔?
Well you see the loading of a website on browser is completely dependent on the DNS if the DNS lookup is fast your website loads faster if it is slow it creates latency and if the DNS fails it tries for the request using other recursive DNS servers if those fails it doen't load at all.