Skip to content

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

  1. Browser/OS Cache: The browser and operating system first check their own caches.
  2. Recursive Resolver: If not cached, the request goes to a recursive resolver (usually from the ISP).
  3. Root Server: The resolver asks a root server, which directs it to a TLD server.
  4. TLD Server: The TLD server (e.g., for .com) directs the resolver to the authoritative nameserver for the domain.
  5. Authoritative Nameserver: This server holds the actual DNS records and returns the IP address to the resolver.
  6. 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.
  • DNS Record Types
  • DNS Caching