What is DNS? How a DNS server works

 What is DNS? How a DNS server works

When was the last time you remembered your friends/family member’s phone number?? Mostly never right?? Of course you don’t need to as that is the role/work of contacts in your phone books are for, you just need to save that number in your phone book and never worry about that number ever again. Well similarly DNS(Domain Name System) is a giant contact list of the internet that maps domain names with the IP(Internet Protocol) addresses.

What is DNS?

The Domain Name System (DNS) is the phonebook of the Internet. We all access information online through domain names, like google.com or youtube.com. Web browsers interact through Internet Protocol (IP) addresses. DNS translates domain names to IP addresses so browsers can load Internet resources.

Each device connected to the Internet has a unique IP address which other machines use to find the device. DNS servers eliminate the need for humans to memorize IP addresses such as 192.168.1.1 (in IPv4), or more complex newer alphanumeric IP addresses such as 2400:cb00:2048:1::c629:d7a2 (in IPv6).

What happens when you request a website on the internet?

Let’s say you type www.pawait.africa or www.pawait.co.ke in your web browser, your query actually travels the internet and reaches your internet service provider to the DNS resolver then queries the root server with the exact domain name typed initially in this case www.pawait.africa, then the root server basically says that I don’t know what the IP address of this domain is but I do know that I have to go to .africa or .co.ke(top level domain server)which might know what the IP address is, so then the DNS resolver then goes to the .africa or .co.ke NS(name server) top level domain server which might know which address this is, so then the DNS resolver goes to the NS TLD(Name Server Top Level Domain) with address in this case pawait.co.ke or pawait.africa server would know the IP address for www so then the DNs resolver goes to the Authoritative Name Server for pawait.africa or pawait.co.ke and brings back the IP address for it i.e 192.168.0.137 then once the IP address is found the DNs resolver sends it back to your computer through the internet(how? Through the internet obviously).

From there, it sends that request to the web server which is sitting at 192.168.0.137 and then the web server responds back with the actual web page which is displayed to the user. What we just discussed above, the resolver makes multiple queries with different nameservers and gets the IP address then sends it back to the user.

Now this doesn’t always happen, you know why?? How many times does your friend’s phone number change? Not very often right? This is the same as the DNS too, so it’s safe to cache the DNS results at multiple locations. In most cases browsers i.e Chrome, Firefox, Opera etc cache the DNS results under queries, so in our case www.pawait.africa, if we again go to the web address, the browser knows or it has cached the DNs record for this address/host.

Similarly if my browser didn’t have this address, if somebody else queried for the website, so the ISP(internet service provider) also caches the DNS server and its records, so if it doesn’t find it in the web browser cache, it is likely to be found in the ISP cache and then from there it will just return the IP address right from the ISP instead of going through the entire recursive query process if it just takes it from the cache which is what happens in most cases because the DNS records don’t often change. For more in-depth insight about DNS and its management, reach out to us at PawaIT Solutions and we will break it down further.