What is DNS and How it works

This article quickly briefs how DNS works at a higher level.

·

3 min read

What is DNS

All devices on the internet, be it your smartphone, computer or laptop etc that serve content communicate with one another using IP addresses. In a nutshell when you want to visit a website you don't have to remember the long number (Forex, 142.250.193.100) instead you can type in the domain name (Forex, www.google.com) and still end up on the website.

But how ?? It is due to DNS

The Domain Name System, or DNS, converts domain names that are human-readable (such as www.google.com) into machine-readable IP addresses (such as 142.250.193.100). DNS is the backbone of the internet.

How DNS works

  • When a user enters the domain in the browser say (test.example.com), the browser first checks whether there is already a DNS entry for test.example.com stored locally in the cache. This cache can be in many places, it can be at the operating system level, browser level etc.

  • If there is an entry in the cache and the cache is not expired, the DNS lookup process stops and it directly maps the IP address from the cache.

  • If not then the request is routed to DNS/Recursive resolver.

DNS/Recursive Resolver

  • DNS/Recursive resolver is typically assigned and managed by your company or ISP.

  • While a recursive DNS provider doesn't hold any DNS records, it serves as a middleman who can obtain the DNS information on your behalf, similar to a hotel concierge.

  • A recursive DNS responds to a DNS query by delivering the IP details if it has the DNS reference cached. If not, it sends the request to one or more name servers

  • First, it sends the requests to the root nameserver

Root Nameserver

  • In the DNS hierarchy, the root nameserver or root DNS server is at the top. Consider it as an index in the book. The information you seek that is, the IP address that corresponds to the domain name is not available, but it does provide information as to where it can be obtained.

  • The top-level domain server of the domain name will be determined by the root nameserver when it gets a request from the recursive DNS resolver. Following that, it will instruct the recursive resolver to go to the correct TLD nameserver.

  • It is managed by ICANN

Top Level Domain Nameserver (TLD)

  • The TLD nameserver is in charge of keeping and administering data about domain names that use a particular top-level domain (TLD) such as .com, .in, .dev etc

  • Once the TLD server receives a request from Root Nameserver it will let the recursive resolver know where the matched IP address is located at a particular authoritative nameserver.

  • It is managed by IANA. (Branch of ICANN)

Authoritative Nameserver

  • The authoritative nameserver contains the IP address matching the domain and it can also contain a reference to another authoritative name server of the subdomain.

  • It provides the IP address to the recursive resolver and the latter sends it back to the client, thus finally directing you to the actual site you wanted to visit.

  • The recursive resolver also caches the entry temporarily so that the next time, it will immediately provide the IP address rather than requiring a lookup.