0004 - DNS (Domain Name System)

Publish date: 2025-06-28
Tags: Networking, Interview-Questions

Basic Concepts

The DNS Resolution Process (Recursive Query)

What happens when you type google.com into your browser?

  1. Browser/OS Cache: The browser first checks its own cache, then the OS cache. If the IP is found, the process stops here.
  2. Recursive Resolver: The user’s computer (the “client” or “stub resolver”) sends a DNS query for www.google.com to its configured Recursive Resolver. This is typically the DNS server provided by your Internet Service Provider (ISP), like Airtel or Jio, or a public resolver like Google’s 8.8.8.8 or Cloudflare’s 1.1.1.1. The query from the client is recursive, meaning it asks the resolver: “Please find the full answer for www.google.com and give it to me.”
  3. Root Servers:  The Recursive Resolver, having no cached entry for this domain, begins an iterative query process. It starts at the top. It sends a query to one of the 13 Root Server IP addresses.
    • Query: “What is the IP address for www.google.com?”
    • Root Server Response: “I do not know. But I can refer you to the TLD servers for .com. Here are their IP addresses.”
  4. TLD (Top-Level Domain) Servers: The Recursive Resolver now uses the information from the Root Server. It picks one of the .com TLD Server IPs and sends it the same query.
    • Query: “What is the IP address for www.google.com?"
    • .com TLD Server Response: “I do not know the IP for the full domain. But I can refer you to the Authoritative Name Servers for the google.com domain. Their names are ns1.google.com, ns2.google.com, etc. Go ask them.”
  5. Authoritative Name Server:  The TLD server responded with names (ns1.google.com), not IPs. If the resolver doesn’t already know the IP for ns1.google.com, it must perform another complete DNS lookup for ns1.google.com to get its IP address. This shows the recursive nature of DNS itself. Let’s assume for simplicity the resolver gets the IP for ns1.google.com. The Recursive Resolver now sends its query to the IP address of Google’s Authoritative Name Server (ns1.google.com).
    • Query: “What is the IP address for www.google.com?"
    • Authoritative Server Response: “I am the authority for google.com. The IP address for the www A record is 142.250.191.78. Here is your answer.”
  6. Response to Client: The resolver passes the IP address back to your OS/browser. The resolver also caches this result for a certain period (defined by the TTL - Time to Live) so it can answer future requests for google.com instantly.**

Common DNS Record Types

Advanced DNS Concepts

Tags: Networking, Interview-Questions