DNS Resolution Process
One-Liner
The step-by-step process of translating a human-readable domain name into a machine-readable IP address.
What It Is
The sequence of queries, starting from a user’s computer, that traverses the DNS hierarchy to find the IP address associated with a domain name.
Why It Exists
To allow users to access websites using easy-to-remember domain names instead of IP addresses, while still allowing computers to communicate using IP addresses.
How It Works
- Browser/OS Cache: The browser and operating system first check their own caches.
- Recursive Resolver: If not cached, the request goes to a recursive resolver (usually from the ISP).
- Root Server: The resolver asks a root server, which directs it to a TLD server.
- TLD Server: The TLD server (e.g., for
.com) directs the resolver to the authoritative nameserver for the domain. - Authoritative Nameserver: This server holds the actual DNS records and returns the IP address to the resolver.
- Resolver to Client: The resolver caches the response and sends the IP address to the client.
Tradeoffs
Pros
- Highly scalable and resilient due to its distributed and hierarchical nature.
Cons
- Can be slow due to the multiple steps involved (though caching helps a lot).
Failure Modes
- DNS Outage: If an authoritative nameserver or a TLD server goes down, domains can become unreachable.
- DNS Cache Poisoning: An attacker can corrupt a DNS cache to redirect users to a malicious site.
Interview Traps
- Not being able to explain the full process from client to authoritative nameserver.
- Confusing recursive and iterative queries.
Real-World Usage
- Happens every time you type a domain name into your browser.
Anti-Patterns
- Setting a very low TTL on DNS records, which can increase the load on DNS servers and slow down resolution.
Related Concepts
- DNS Record Types
- DNS Caching