🌐 DNS Deep Dive 6 min de lectura

How DNS Works

Understand the DNS resolution process from your browser to the authoritative name server.

The DNS Resolution Process

When you type www.example.com into your browser, a complex chain of lookups happens in milliseconds. Here's how DNS translates that human-readable name into an IP address.

Step-by-Step Resolution

1. Browser Cache

Your browser first checks its own DNS cache. If you've visited example.com recently, the IP address may already be stored locally.

2. OS Cache

If the browser cache misses, the operating system checks its DNS cache. On Linux, you can view cached entries with resolvectl statistics.

3. Recursive Resolver

If no local cache has the answer, your device sends the query to a recursive resolver — typically provided by your ISP or a public DNS service like Cloudflare (1.1.1.1) or Google (8.8.8.8).

The recursive resolver does the heavy lifting. If it doesn't have the answer cached, it performs a series of queries:

4. Root Name Servers

The resolver first contacts one of the 13 root name server groups (labeled A through M). The root server doesn't know the IP of example.com, but it knows which servers are authoritative for .com and returns a referral.

5. TLD Name Servers

The resolver follows the referral to a .com TLD server. This server doesn't know example.com's IP either, but it knows which name servers are authoritative for example.com and returns another referral.

6. Authoritative Name Server

Finally, the resolver queries the authoritative name server for example.com. This server has the actual DNS records and returns the IP address (e.g., 93.184.216.34).

The Full Chain

Browser → OS → Recursive Resolver → Root Server → TLD Server → Authoritative Server
                                                                      ↓
Browser ← OS ← Recursive Resolver ←────────────────── IP: 93.184.216.34

Caching and TTL

Each DNS response includes a TTL (Time to Live) value that tells resolvers how long to cache the answer. Common TTL values:

TTL Duration Use Case
300 5 minutes Dynamic services, failover
3600 1 hour Standard websites
86400 24 hours Stable records

Recursive vs Iterative Queries

  • Recursive query: The client asks the resolver to do all the work and return the final answer
  • Iterative query: The resolver asks each server in the chain, receiving referrals to follow

Most client-to-resolver queries are recursive. Resolver-to-server queries are iterative.

Ver también