Working of DNS Without Cache and With Cache

Discuss the working of DNS

Working of DNS

When you type a domain name into your browser, DNS starts working behind the scenes to find the correct IP address. This process happens through multiple servers and usually completes in milliseconds.

To really understand it, you need to look at two cases. One is when there is no cached data. The other is when caching is used.

DNS Working Without Cache

working-of-dns-without-cache-and-with-cache-4

A recursive resolver is the first place your request goes. Think of it as a middleman between you and the rest of the DNS system.

When you enter www.nerdstudyhub.com, your device sends a query to the recursive resolver. If it does not already know the answer, it starts the lookup process from scratch. The resolver first contacts a root name server. Root servers do not know the exact IP address, but they know where to look next. Based on the domain extension, they direct the resolver to the correct top level domain server.

Now the resolver queries the .com TLD server. This server keeps records of domains under .com. It responds by giving the address of the authoritative name servers for nerdstudyhub.com, such as:

ns1.domaininnepal.com
ns2.domaininnepal.com
ns3.domaininnepal.com
ns4.domaininnepal.com

Next, the resolver sends a request to one of these authoritative servers. This server holds the actual DNS records. It responds with the IP address:

www.nerdstudyhub.com → 209.42.27.15

Finally, the recursive resolver sends this IP address back to your device. Now your browser can connect to the server and load the website.

A popular example of a recursive resolver is Cloudflare.

How DNS Navigates Without Cache

Working of DNS Without Cache and With Cache

  • The resolver always starts from the top of the hierarchy. It already knows the addresses of root servers, so it begins there.
  • The root server directs it to a TLD server based on the domain extension like .com, .org, or .np.
  • The TLD server then points to the authoritative server responsible for that domain.
  • Finally, the authoritative server provides the exact IP address.

 

  • Generic top level domains include .com, .org, .net, .edu, and .gov.
  • Country code top level domains include .np, .uk, .us, and .ru.

DNS Working With Cache

 

working-of-dns-without-cache-and-with-cache-7

Now here’s where things get faster.

Once a resolver finds an IP address, it stores that result in its cache for a certain period. This means the next time someone requests the same domain, the resolver does not need to repeat the entire process. For example, if the resolver already knows that www.nerdstudyhub.com maps to 209.42.27.15, it returns the answer immediately. No need to contact root, TLD, or authoritative servers again. Even TLD servers and local DNS servers cache responses. This reduces traffic and speeds up the entire system. Caching makes DNS efficient. Without it, every request would have to travel through multiple servers every time.

In Short:

  • A client sends a query to the local name server.
  • The resolver starts at the root of the DNS hierarchy by contacting a root name server.
  • The root server directs the query to the appropriate TLD server such as .com or .np.
  • The TLD server responds with the authoritative name server for the domain like nerdstudyhub.com.
  • The authoritative server resolves the query and returns the IP address to the local DNS server.
  • Finally, the client receives the IP address and connects to the website.
  • With caching, once a mapping is learned, it is stored and reused. This reduces lookup time and improves performance across the network.
Share: Facebook LinkedIn X

More Study Materials

Useful Resources