Loading learning content...
When you type www.example.com into your browser and press Enter, a remarkable distributed computation begins. Within milliseconds, your computer must discover the IP address of a server that could be anywhere on Earth—and it accomplishes this through a process called name resolution.
Name resolution is the core function of DNS—the mechanism by which human-readable domain names are translated into machine-routable IP addresses. This process involves multiple servers, sophisticated caching strategies, and a carefully designed query protocol that handles billions of requests daily.
Understanding name resolution is essential for network engineers, system administrators, and developers alike. It explains why websites sometimes "can't be found," how DNS propagation works, and why changing a domain's IP address isn't instantaneous.
By the end of this page, you will understand the complete name resolution process—from the moment your browser needs an IP address to the final answer arriving in your network stack. You'll learn about stub resolvers, recursive resolvers, authoritative servers, and the query protocols that connect them.
Name resolution is the process of determining the IP address (or addresses) associated with a given domain name. This concept encompasses several related ideas:
Forward Resolution: The most common form of DNS resolution, where a domain name is translated into an IP address:
www.google.com → 142.250.185.68api.github.com → 20.26.156.215Reverse Resolution: The opposite process, translating an IP address back to a domain name:
8.8.8.8 → dns.google1.1.1.1 → one.one.one.oneReverse resolution uses a special domain hierarchy under in-addr.arpa (for IPv4) and ip6.arpa (for IPv6).
The Resolution Chain:
Name resolution is rarely a single query-response pair. Instead, it's typically a chain of queries involving multiple servers, each contributing partial knowledge until the complete answer is assembled.
The terms 'DNS resolution,' 'DNS lookup,' and 'name resolution' are often used interchangeably. Technically, 'resolution' refers to the complete process of finding an answer (which may involve multiple lookups), while 'lookup' can refer to a single query-response interaction. In practice, most people use these terms synonymously.
Why Resolution is Non-Trivial:
A naive approach might suggest a single, central database mapping all domain names to IP addresses. However, this approach fails at internet scale for several reasons:
The solution is a distributed, hierarchical system where resolution involves multiple specialized servers, each responsible for a portion of the namespace.
The name resolution process involves several distinct components, each playing a specific role:
1. Stub Resolver (DNS Client)
The stub resolver is the DNS client software built into your operating system. When an application needs to resolve a domain name, it calls the stub resolver (typically through functions like getaddrinfo() or gethostbyname()).
Stub resolver characteristics:
1234567891011121314
# On most Unix-like systems, stub resolver configuration is in /etc/resolv.conf # Example /etc/resolv.conf configuration:nameserver 8.8.8.8 # Primary DNS (Google Public DNS)nameserver 8.8.4.4 # Secondary DNSnameserver 1.1.1.1 # Tertiary DNS (Cloudflare)options timeout:2 # Query timeout in secondsoptions attempts:3 # Number of retry attempts # The stub resolver will:# 1. Try 8.8.8.8 first# 2. Wait up to 2 seconds for response# 3. Retry up to 3 times if no response# 4. Fall back to secondary/tertiary servers if primary fails2. Recursive Resolver (DNS Recursor)
The recursive resolver is the workhorse of DNS resolution. It accepts queries from stub resolvers and does the actual work of traversing the DNS hierarchy to find answers.
Recursive resolver characteristics:
3. Authoritative Name Servers
Authoritative servers are the ultimate source of truth for DNS records. They hold the actual data for their zones and respond definitively to queries about names in those zones.
Authoritative server types:
.com domains)example.com)Let's trace the complete resolution of www.engineering.example.com from start to finish, examining every step in detail:
Step 1: Application Request
A user types the URL into their browser. The browser's networking code needs to establish a TCP connection to the web server, which requires an IP address.
Browser: "I need IP address for www.engineering.example.com"
Step 2: Stub Resolver Cache Check
The stub resolver first checks its local cache. If this domain was resolved recently and the cached answer hasn't expired (TTL not exceeded), the cached IP is returned immediately—no network traffic required.
Stub Resolver: Check local cache... Cache miss.
Step 3: Query to Recursive Resolver
The stub resolver sends a query to its configured recursive resolver (e.g., ISP's DNS or public DNS like 8.8.8.8).
Query: Type=A, Name=www.engineering.example.com
From: Client → Recursive Resolver
Step 4: Recursive Resolver Cache Check
The recursive resolver checks its own cache. Since it serves many clients, there's a good chance someone recently queried this or a related domain.
Recursive Resolver: Check cache... No exact match.
Recursive Resolver: Check cache for 'engineering.example.com' NS records... Miss.
Recursive Resolver: Check cache for 'example.com' NS records... Miss.
Recursive Resolver: Check cache for 'com' NS records... Hit! (TLD info cached)
Note: Recursive resolvers cache not just final answers but also intermediate information (NS records for various delegations). This allows them to skip earlier steps in subsequent queries.
Step 5: Query to Root Servers (if needed)
If no cached information exists, the recursive resolver starts at the root. It has a built-in list of root server addresses (the "root hints file").
Recursive Resolver → Root Server:
Query: "Who handles the .com TLD?"
Root Server Response:
"I don't know www.engineering.example.com, but .com is handled by
these TLD servers: a.gtld-servers.net (192.5.6.30), ..."
Step 6: Query to TLD Servers
The recursive resolver queries a .com TLD server:
Recursive Resolver → .com TLD Server:
Query: "Who handles example.com?"
TLD Server Response:
"I don't know www.engineering.example.com, but example.com is handled by
these authoritative servers: ns1.example.com (93.184.216.34), ..."
Step 7: Query to Authoritative Servers
The recursive resolver queries the authoritative server for example.com:
Recursive Resolver → example.com Authoritative Server:
Query: "What is the IP address for www.engineering.example.com?"
Authoritative Server Response (Type A):
"www.engineering.example.com has IP address 203.0.113.50"
"TTL: 3600 seconds (1 hour)"
Step 8: Response Caching and Return
The recursive resolver caches the answer (and all intermediate NS records) according to their TTLs, then returns the answer to the stub resolver:
Recursive Resolver → Stub Resolver:
Answer: www.engineering.example.com = 203.0.113.50
TTL: 3600 seconds
Stub Resolver: Cache this answer, return to application.
Application: Connect to 203.0.113.50:443
| Step | Operation | Time (Cold Cache) | Time (Warm Cache) |
|---|---|---|---|
| 1-2 | Application → Stub Resolver | < 1ms | < 1ms |
| 3 | Stub → Recursive Resolver | 5-50ms | 5-50ms |
| 4 | Recursive Resolver cache check | < 1ms | < 1ms (HIT) |
| 5 | Recursive → Root Server | 10-100ms | Skipped (cached) |
| 6 | Recursive → TLD Server | 10-100ms | Usually skipped |
| 7 | Recursive → Authoritative | 20-200ms | Sometimes skipped |
| 8 | Response to client | 5-50ms | 5-50ms |
| Total | End-to-end resolution | 50-500ms | 10-100ms |
DNS supports two query modes, each with distinct behaviors and use cases:
Recursive Query:
In a recursive query, the client asks the server to provide the complete answer. If the server doesn't have the answer, it must query other servers on the client's behalf and return the final result.
Iterative Query:
In an iterative query, the client asks the server for its best answer. If the server doesn't have the definitive answer, it returns a referral—the address of another server that might know better.
The Hybrid Reality:
In practice, DNS resolution combines both modes:
This hybrid approach optimizes the system: lightweight clients make simple recursive requests, while powerful recursive resolvers handle the complexity of iterating through the DNS hierarchy.
Caching is fundamental to DNS's ability to handle billions of queries daily. Every component in the resolution chain maintains caches that dramatically reduce query volume and latency.
Caching at Multiple Levels:
1. Browser Cache: Modern browsers maintain their own DNS caches, independent of the OS.
chrome://net-internals/#dnsabout:networking#dns2. Operating System Cache: The OS stub resolver caches resolutions for all applications.
ipconfig /displaydns3. Recursive Resolver Cache: Large cache shared across all clients of that resolver.
4. Authoritative Server Response Cache: Some authoritative servers cache zone data in memory for fast response.
Every DNS record includes a Time-To-Live (TTL) value specifying how long the record may be cached. When you change a DNS record, the old record may persist in caches worldwide until TTLs expire. This is why DNS 'propagation' takes time—it's really cache expiration, not propagation.
Cache Hit Rates:
Large recursive resolvers often achieve cache hit rates of 80-95%. This means only 5-20% of queries actually require traversing the DNS hierarchy. The implications are significant:
| Record Type | Common TTL | Rationale |
|---|---|---|
| Root/TLD NS records | 2-7 days | Rarely change, cache aggressively |
| Domain NS records | 1-24 hours | Occasional changes for migrations |
| A/AAAA records | 5 mins - 1 hour | Balance between caching and flexibility |
| MX records | 1-4 hours | Mail routing changes occasionally |
| TXT records | 5-60 minutes | Verification records need quick updates |
| Load-balanced records | 30-300 seconds | Frequent changes for traffic distribution |
Negative Caching:
DNS also caches negative results—when a domain doesn't exist (NXDOMAIN response). This prevents repeated queries for typos or non-existent domains.
DNS queries and responses follow a well-defined protocol format, specified in RFC 1035 and extended by numerous subsequent RFCs.
Transport Protocols:
UDP (Port 53):
TCP (Port 53):
1234567891011121314151617181920212223242526272829303132
DNS Message Format (simplified)================================ +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+| ID | 16-bit identifier+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+|QR| Opcode |AA|TC|RD|RA| Z | RCODE | Flags+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+| QDCOUNT | Number of questions+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+| ANCOUNT | Number of answers+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+| NSCOUNT | Number of authority records+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+| ARCOUNT | Number of additional records+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+| QUESTION | Query name and type+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+| ANSWER | Resource records answering query+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+| AUTHORITY | NS records for authoritative servers+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+| ADDITIONAL | Additional helpful records (glue)+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ Key Flags:- QR: Query (0) or Response (1)- AA: Authoritative Answer- TC: Truncated (response too large for UDP)- RD: Recursion Desired- RA: Recursion Available- RCODE: Response code (0=success, 3=NXDOMAIN, etc.)Query Types:
DNS supports numerous record types, each serving different purposes:
| Type | Name | Purpose |
|---|---|---|
| A | Address | IPv4 address for a host |
| AAAA | IPv6 Address | IPv6 address for a host |
| NS | Name Server | Authoritative servers for a zone |
| MX | Mail Exchange | Mail servers for a domain |
| CNAME | Canonical Name | Alias to another domain name |
| TXT | Text | Arbitrary text (SPF, DKIM, verification) |
| SOA | Start of Authority | Zone metadata and parameters |
| PTR | Pointer | Reverse DNS (IP to name) |
| SRV | Service | Service location (port, protocol) |
EDNS0 (Extension Mechanisms for DNS):
EDNS0 (RFC 6891) extends DNS capabilities beyond the original specification:
Not every DNS resolution succeeds. Understanding failure modes is crucial for troubleshooting:
Common Resolution Errors:
Troubleshooting Resolution Issues:
Timeout/No Response:
SERVFAIL:
NXDOMAIN:
Wrong Answer/Unexpected IP:
12345678910111213141516171819202122232425262728
# Common DNS troubleshooting commands # Basic resolution testnslookup example.comdig example.com # Query specific DNS serverdig @8.8.8.8 example.com # Get detailed response with all sectionsdig +noall +answer +authority +additional example.com # Trace resolution path (shows each step)dig +trace example.com # Check for DNSSECdig +dnssec example.com # Reverse lookupdig -x 93.184.216.34 # Check specific record typesdig example.com MXdig example.com TXTdig example.com NS # Windows alternativenslookup -type=MX example.comWe've explored the complete name resolution process—from initial query to final answer. Let's consolidate the key concepts:
What's Next:
Now that we understand how name resolution works, the next page explores the history of DNS—how we went from simple host files to the global distributed system we rely on today. Understanding this history provides context for DNS's design decisions and current architecture.
You now understand the complete name resolution process—from application request to IP address delivery. This knowledge is fundamental for troubleshooting DNS issues, understanding performance implications, and designing systems that interact with DNS infrastructure.