How DNS Resolution works

▶DNS- Domain name system
It converts names → IP addresses. In simple, Computer talk using IP Addresses (like 142.250.190.14), but humans prefer names to talk(like google.com)
Ex.-You search a person’s name in your phone to get their number. DNS does the same for websites.
Without DNS , you have to remember IP addresses for every websites.
▶dig command
dig(Domain Information Groper) is a DNS diagnostic tool
We can say dig is an X-RAY tool for DNS, You cannot see DNS normally ,but dig shows you what is happening inside
Ex.- dig google.com
It is used to check whick DNS server answer a query OR to see DNS records (A, NS ,MX, etc)
▶DNS resolution
Simply-
DNS-like asking for an address step by step
1)Root level or top level(.)
This is the starting point.
2)TLD level(.com , .org, ,.net)
These servers know which company or server handle a specific domain like- google.com
3)Authoritative level(google.com)
This is the final level.It knows the exact IP address of the website.
Working-
DNS ask the root server - where is .com?, then ask the .com server - where is google.com?, then ask google’s server -where is IP? ,IP address is returned - then website open
▶dig . NS -Root name server
(.)means the root zone and NS means Name Server
Simple meaning:- This ask who manages the top of the DNS hierarchy?
▶dig com NS(TLD NAME SERVER)
Simply this ask -who manage the .com domains?
▶dig google.com NS
This asks - who is the final authority for google.com?
so we can also say this as Authorative name servers
ex- ns1.google.com (This gives the final answer)
What actually happening behind the scene-
Browser is asking to ISP OR DNS ,then DNS asking to root server , then root is replying that ask .com servers , then dns ask TLD servers , then TLD replies to ask GOOGLE’S server, then we gets final IP that returns to browser
▶NS record represents , it tell -who is responsible for this domain?
▶Connecting dig google.com to real world browsing
Simply, when we type www.google.com
our browser uses DNS to get the IP and it connects to IP then sends HTTP request and