DNS
How domain names resolve to IP addresses, DNS hierarchy, and caching
What is DNS?
The phonebook of the internet
DNS (Domain Name System) translates human-friendly domain names like
www.google.com into IP addresses like
142.250.80.46 that computers use to identify each other.
Without DNS, you'd need to memorize IP addresses for every website you visit. DNS makes the internet usable by letting us use memorable names instead of numbers.
DNS Resolution Process
What happens when you type a URL
DNS Lookup Journey
Follow the query as it travels through the DNS hierarchy
You type www.example.com in your browser
Why so many steps?
This iterative process only happens on the first lookup. Results are cached at each level, so subsequent requests are much faster. A typical cached lookup takes ~1-5ms instead of ~100ms+.
DNS Hierarchy
The tree structure of domain names
DNS Tree Structure
Understanding how domains are organized hierarchically
How to Read a Domain Name
Interview Insight
The trailing dot in www.example.com. represents the root.
It's usually omitted but technically a fully qualified domain name (FQDN) includes it.
This is why DNS is called a hierarchical system - each level
delegates to the next.
DNS Record Types
Different records serve different purposes
Quick Reference
Common Interview Question
"What's the difference between A and CNAME records?"
A record points directly to an IP address.
CNAME points to another domain name (which then resolves to an IP).
CNAMEs can't be used at the zone apex (root domain) - you need an A record there.
DNS Caching
How caching improves performance
Caching Layers
DNS responses are cached at multiple levels to reduce lookup time
Understanding TTL (Time To Live)
Pro tip: Before a migration, lower TTL to 300 seconds 24-48 hours ahead. After the change, wait for the old TTL to expire, then raise TTL back up.
DNS Propagation
When you update DNS records, the changes don't happen instantly everywhere. Different caches expire at different times based on their TTL values.
Popular Public DNS Resolvers
Key Terms to Remember
Master these terms for technical interviews