Table of Contents

What is DNS?

DNS used to be a very big old register which stores information like google.com is accessible on 192.83.47.129 our grandfathers referred to it as ARPANET.
The only change here is that now it is a distributed system that runs in many locations and with much more complexity.

Different Components

A typical DNS(Domain name system) comprises the following components though there is some overlap when it comes to how industry uses it :

  1. Resolver (DNS Client)
  2. Recursive Resolver (Recursive DNS server)
  3. Root Server
  4. TLD Server
  5. Authoritative Name Server
  6. DNS Records
  7. Caching
  8. Zones

WorkFlow

When we type www.aneeshkhunteta.com in our browser what all stuff goes on in the background?
Browser checks its cache to see if the resource is already stored.
If yes, it will show it. If not, it asks the resolver.

Resolver

This is your internet service provider, for example Jio. Now, it will check if it has the required address.
if yes, it will send that back to the browser, if not, it asks the recursive resolver to bring that.

Recursive Resolver

Now, everyone cannot just give the responsibility to someone else and expect it to be done. So, clearly someone has to take the responsibility. Recursive resolver does that. It asks different types of DNS servers and gathers all the information and returns it to Resolver. Recursive resolver starts the process by asking Root server.

Root Server

These are the servers maintained by some organisations and they are strategically placed around the world for connectivity.
This does not contain the IP addresses of www.aneeshkhunteta.com, but it knows where to find it. And it does that by guiding the recursive resolver to TLD Server for .com domain. It tells the recursive resolver to ask the TLD server(as given by root server) for the IP.

Recursive resolver will now ask TLD server for the IP.

TLD(Top-Level Domain) Server

These are the servers which store information for a specific TLD, like .net, .com, .org. Now, it does not know the exact IP address of www.aneeshkhunteta.com, but it knows someone who might. As, in this case, we are searching for .com, it will tell us the exact Authoritative Server to ask for IP.

Recursive resolver will now ask Authoritative Server for the IP.

Authoritative Server

These are the servers which are the last hope to know about the IP. These are the ones which have all the exact information about a domain. Authoritative Server stores this info in the form of DNS Records.

DNS Records

All the DNS servers store their information in the form of DNS record. There are many different ways a record is stored but here is one way of storing.

Domain TTL CLASS Type Data
google.com 3600 IN A 82.123.23.45
www.google 3600 IN CNAME google.com
google.com. 3600 IN MX mail.google
mail.google 3600 IN A 82.123.23.45
google.com. 3600 IN TXT “yo waasup?”

Domain → It is just the domain name.
TTL → It is Time-to-live, which means how long(in seconds) you should cache this DNS Record.
CLASS → It is an older term which is now limited to IN for Internet.
Type → It means what type of data you are going to find in this record.

  • A → IPv4 Address
  • AAAA → IPv6 Address
  • CNAME → Canonical Name(alias)
  • MX → Mail Exchange Servers
  • NS → Name Servers for the Domain
  • TXT → Miscellaneous Text
  • SOA → Start of Authority, contains info about the domain.

Data → The data about the record.

Final Resolution

Now, coming back to our search of IP for www.aneeshkhunteta.com. When asked by the recursive resolver, Authoritative Server returns the exact IP for that by looking at corresponding DNS Record.
Now that Recursive Resolver has the IP it will return it to the Resolver. Resolver will return it to the browser and browser will make an HTTP/HTTPS call to that server’s IP and show the page.

Now, to make sure this eternity long process does not happen too frequently, Caching is done at various stages.

Caching

Storing information which can be asked frequently to save on the fetching overhead of that information. The Resolver DNS server takes care of caching at its end. There are many people using the Jio network and many people might request for www.aneeshkhunteta.com(well I hope so), so the frequent request will be served faster.

Zones

As we have seen DNS is a big tree of Servers. So there are many subtrees which are referred to as zones. In the tree, server above is responsible for servers below it. Here is an example to understand zones.

graph TD A[Root DNS Server] --> B[.com Zone] A --> C[.org Zone] B --> D[aneeshkhunteta.com Zone] D --> E[www.aneeshkhunteta.com] D --> F[mail.aneeshkhunteta.com] C --> G[aneeshkhunteta.org Zone] G --> H[www.aneeshkhunteta.org] G --> I[mail.aneeshkhunteta.org]

Summary

Now, to summarize, there’s a lot that goes on behind the scenes to open a webpage. What is shown here provides some clarity on the topic, but in reality, the subject is much deeper. Below is a flowchart of the process described above.

graph TD Browser["Browser"] Resolver["Resolver (ISP DNS)"] Recursive["Recursive Resolver"] Root["Root Server"] TLD["TLD Server (.com)"] Authoritative["Authoritative Server"] Records["DNS Records"] Server["Target Web Server"] Browser -->|Check local cache| CheckCache{Cache hit?} CheckCache -- Yes --> ShowPage["Use IP & Render Page"] CheckCache -- No --> Browser -->|Ask for IP of www.aneeshkhunteta.com| Resolver Resolver -->|Check resolver cache| ResCache{Cache hit?} ResCache -- Yes --> Resolver -->|Return cached IP| Browser ResCache -- No --> Resolver -->|Forward query| Recursive Recursive -->|Q: Where is .com?| Root Root -->|A: Ask TLD Server for .com| Recursive Recursive -->|Q: Where is aneeshkhunteta.com?| TLD TLD -->|A: Ask authoritative server| Recursive Recursive -->|Q: What is IP of www.aneeshkhunteta.com?| Authoritative Authoritative -->|A: Check DNS Records| Records Records -->|Return IP address| Authoritative Authoritative -->|Return IP| Recursive Recursive -->|Return IP| Resolver Resolver -->|Return IP| Browser Browser -->|Make HTTP/HTTPS request| Server Server -->|Return webpage| Browser classDef cache fill:#f9f,stroke:#333,stroke-width:1px; class CheckCache,ResCache cache;

References