Networking: DNS - Domain Name System

Networking: DNS - Domain Name System

·

3 min read

Over a network, all network devices (like computers) are identified by IP addresses to communicate with each other. But how can we identify or communicate with a device in a network? Using these IP addresses? Isn't it hard to remember those numbers? So is it possible to name them? And the answer is Yes!

computer_ip_address.png

DNS server resolves a domain name to an IP address. Web addresses or domain names are something that we can remember easily. Let's say, for shopping with the amazon website, we simply put its domain name amazon.in in the browser and the DNS server would resolve it to a number i.e IP address, to retrieve the web page or we can also retrieve them by typing in its IP address directly - then, in this case, DNS won't come into the picture.

So we can say that DNS acts as a translator between a computer and a human and it maintains a record where domain names are mapped to the respective IP addresses.

✨What happens when we hit a web address in a browser 🤔

When we type in a URL (say amazon.in) in a browser and hit Enter, the DNS server will search through its database for a matching IP address for the domain name. On getting the IP address associated with the domain name, our computer is able to communicate with the requested server and retrieve the web page.

✨Types of DNS servers 📃

  • DNS recursive resolver or DNS resolver
  • Root name server
  • Top-level Domain server or TLD name server
  • Authoritative name server

✨Working of DNS 💻

The browser first searches for the URL's IP address in its cache memory, if can't find it, it then sends the DNS query to the DNS Resolver server. DNS resolver is provided by ISP (Internet Service Provider).

DNS_hierarchy.png

If the Resolver fails to find then it directs the DNS query to the Root server - top or root in the DNS hierarchy. It responds by sending the TLD name server's IP address based on extensions like .com, .in, .org, etc.

Top Level Domain (TLD) server stores the information of all the websites of a specific extension which are called top-level domains. For eg, here, the .in (dot in) TLD server stores all the details of websites with the top-level domain as .in. But TLD can't give the IP address of the site, hence it redirects the DNS query sent by the Resolver to the last level of the DNS hierarchy which is the Authoritative name server by providing its IP address to the Resolver.

Authoritative name server contains information about a domain name including the website's IP address. The resolver receives the actual IP address of the website from the Authoritative server and sends it to the client i.e browser, which in turn requests the server (here, amazon server) for the web page i.e amazon.in using that IP address.

The received address is also stored in cache memory by the Resolver so that when a user requests the URL for the second time, the DNS Resolver doesn't have to go through all the steps again.

Thanks for reading 😇