DNS stands for Domain Name System. Think of DNS is equivalent of Contact book. How the contact book works, if you want to call your friend there are 2 ways. you will open contacts list and search his name and call him, or you will type his phone number directly if you remember it.
On the internet every device has a unique IP address, to access any device we need to know its IP address, without IP address we can’t access. When we type any domain name in the browser like google.com in the backend IP Address is being used to access this website.
How Does Computer know the IP of other Computers?
That’s where the role of DNS Servers came into place, DNS Server Stores the IP Address of every domain name into its database/storage, When we hit URL into browser it sends request to the DNS Server, then it searches in its database and returns IP Address of that domain and then again our computer uses this IP Address to connect with the device.
Low-Level Overview of How DNS Server Works
Lets Dive litter bit deeper, There are 4 type of DNS Server.
- Recursive DNS
- Root Name Server
- Top Level Domain (TLD) Server
- Authoritative DNS Server
If the computer does not know the IP Address, then a DNS Query happens, it first tries to find its IP address into its local storage and in case of windows OS it searches hosts.txt file, if not found then it sends a request to Recursive DNS (provide by your local internet service providers), it stores the IP Address of domain name temporary, it updates itself after a certain period of time, because some website IP address changes and it provides the latest
if the IP Address is not found from recursive domain name server then it sends a request to root NS, then the root NS checks the last part of the requesting domain name. for example google.com, it checks .com, and sends the IP of TLD NS and tell that get IP from TLD Server, then TLD NS find the first part of the domain like google and turn back its
After finding the IP Address the Recursive NS saves it for future use to save request timing of domain.
Yes, although we can visit any website using IP, like if we hit 18.104.22.168 into the browser google will open. but can you remember IPs of all other websites ? No, because human can remember names instead of numbers. It is easy to remember amazon.com, google.com , yahoo.com but not 22.214.171.124 bla bla.
That’s why DNS helping us to remember names only it will do the conversion of domain names to
If somehow malicious software changes the cache of your DNS with their malicious
If you guys like my post please share with others.