When you type www.google.com in your browser, how does your system know where to send the request? Computers don’t understand human-friendly names like google.com — they communicate through IP addresses (e.g., 142.250.182.14).
The Domain Name System (DNS) is the “phonebook of the internet” that translates domain names into IP addresses.
Key Components of DNS
- DNS Resolver (Client-Side Resolver)
- Usually provided by your ISP or configured manually (e.g., Google Public DNS: 8.8.8.8).
- Acts as the middleman that queries DNS servers on behalf of your computer.
- Root DNS Servers
- The starting point of the DNS hierarchy.
- There are 13 logical root servers (labeled A–M), but each has many global replicas.
- Top-Level Domain (TLD) Servers
- Handle extensions like .com, .org, .net, .in, .dev.
- They don’t know the exact IP of your domain but know which Authoritative Name Server to ask.
- Authoritative Name Servers
- The final authority for a domain.
- Stores actual DNS records (A, AAAA, MX, CNAME, etc.) that map the domain to an IP.
- Caching Layers
- DNS resolvers and even your OS/browser cache responses to speed up repeated lookups.
Step-by-Step: How DNS Resolution Works
Let’s trace what happens when you visit www.google.com.
Step 1: User enters domain
- You type www.google.com in your browser.
- The browser checks its cache first (if it has recently resolved it).
Step 2: Operating System cache check
- If the browser doesn’t have it, the OS checks its local DNS cache.
- On Linux/Mac → nscd/systemd-resolved,On Windows → DNS Client Service.
Step 3: Query to Recursive Resolver
- If not cached locally, the request is sent to the recursive resolver (usually your ISP’s DNS or 8.8.8.8).
- The resolver’s job: find the IP address of the requested domain.
Step 4: Root DNS Server
- The resolver queries a Root DNS server.
- Root doesn’t know the IP of www.google.com, but it knows where to find .com TLD servers.
- It replies: “Go ask the .com TLD servers.”
Step 5: TLD Server
- Resolver queries a .com TLD server.
- The TLD server responds with: “Ask Google’s authoritative name servers.”
Step 6: Authoritative Name Server
- Resolver now queries Google’s authoritative server (e.g., ns1.google.com).
- That server finally replies with the actual IP address for www.google.com.
Step 7: Return the Result
- The resolver sends the IP back to your OS → browser.
- Browser uses this IP to establish a TCP connection and fetch the web page.
This whole process usually takes milliseconds because of caching.
Example Flow in Diagram
Browser → OS Cache → Resolver (8.8.8.8)
→ Root DNS → .com TLD → Google Authoritative Server → IP Address
Optimization with Caching
- Browser Cache: Holds DNS results for a few minutes.
- OS Cache: Reduces repeated queries.
- Resolver Cache: Recursive resolvers cache responses using TTL (Time To Live) values from DNS records.
This caching is why the DNS process often feels instant — the full multi-step resolution only happens once per TTL expiry.
Advanced Topics
1. DNS over HTTPS (DoH) / DNS over TLS (DoT)
- Encrypt DNS queries to prevent eavesdropping or manipulation.
- Growing trend for privacy (Chrome, Firefox, Cloudflare).
2. DNS Load Balancing
- Big players (like Google, Netflix) use DNS to distribute traffic.
- Multiple IPs for a single domain → resolver picks one.
3. Content Delivery Networks (CDNs)
- Use Geo-DNS to direct users to nearest data center.
- Example: www.netflix.com resolves to different IPs depending on your location.
4. DNS Record Types
- A → Maps hostname to IPv4.
- AAAA → Maps to IPv6.
- CNAME → Alias to another domain.
- MX → Mail server records.
- TXT → Misc (e.g., SPF/DKIM for email security).
Interview-Level Insights
- Q: Why is DNS hierarchical instead of centralized?
- Scalability and fault tolerance. A single global server would be a massive bottleneck.
- Q: What happens if a Root Server is down?
- Nothing major. Since they’re replicated worldwide, queries automatically failover.
- Q: How does caching affect propagation delay (e.g., after updating DNS records)?
- DNS changes depend on TTL expiry. Until cached records expire, old values may be served.
Conclusion
DNS is the hidden backbone of the internet — a distributed, hierarchical, and resilient system that makes web browsing seamless.
When preparing for Google or FAANG-level interviews, focus not only on “what DNS does” but also on how caching, security, and scalability are achieved at global scale.