What DNS is and why it exists
DNS maps domain names that people can remember, like whatip.xyz, to the IP addresses that machines use to connect, like 203.0.113.10. People are good at names and bad at long strings of numbers, while routers and servers are the opposite. DNS sits in the middle and translates between the two.
The system is deliberately decentralized. No single organization holds every record. Instead, responsibility is delegated down a tree, so the operators of each domain control their own records while the overall structure stays consistent. This design lets DNS scale to billions of names without a central bottleneck.
The resolution path, step by step
When you request a name, several different servers cooperate to find the answer. Here is the typical journey for a fresh lookup of www.example.com that is not yet cached anywhere.
1. The stub resolver on your device
Your operating system has a small piece of software called a stub resolver. It does not do the searching itself. It simply forwards the question to a recursive resolver, usually run by your internet provider or a public service such as a well-known DNS provider.
2. The recursive resolver
The recursive resolver is the workhorse. Its job is to chase down the answer by asking other servers in turn. If it already has the answer in its cache from a recent lookup, it returns that immediately. Otherwise it begins the hierarchy walk described below.
3. The root servers
The resolver first asks a root server. The root does not know the address of www.example.com, but it knows who is responsible for the .com top-level domain. It replies with a referral pointing the resolver toward the .com servers.
4. The TLD servers
Next the resolver asks a .com top-level domain server. The TLD server does not hold the final answer either, but it knows which name servers are authoritative for example.com. It returns another referral, this time pointing at the authoritative servers for the domain.
5. The authoritative server
Finally the resolver asks the authoritative name server for example.com. This server holds the real records, so it returns the actual IP address for www.example.com. The resolver passes that answer back to your device, your browser opens a connection, and the page loads.
The whole chain, resolver to root to TLD to authoritative, often completes in well under a second on a first lookup, and far faster when cached.
Common DNS record types
A domain's records define how it behaves. The most common types you will encounter are:
- A maps a name to an IPv4 address.
- AAAA maps a name to an IPv6 address.
- CNAME is an alias that points one name at another name.
- MX specifies the mail servers that accept email for the domain.
- TXT holds free-form text, widely used for email authentication policies and domain verification.
- NS lists the authoritative name servers for the domain.
- SOA is the start of authority record, holding administrative details like the primary server and refresh timers.
- CAA states which certificate authorities are allowed to issue certificates for the domain.
You can inspect any of these for a real domain using the WhatIP dns-lookup tool, and check mail routing specifically with the mx-lookup tool.
Caching and TTL
If every lookup had to walk the full hierarchy every time, DNS would be slow and the root and TLD servers would be overwhelmed. Caching prevents this. When a resolver receives an answer, it stores the record for a set amount of time before discarding it.
That lifetime is the TTL, or time to live, measured in seconds and attached to every record by the domain owner. A record with a TTL of 3600 may be cached for one hour. During that hour, any device asking the same resolver for the same name gets the cached answer instantly, with no hierarchy walk at all.
A worked example of TTL behavior
Imagine an A record for blog.example.com pointing at 198.51.100.20 with a TTL of 3600 seconds. You decide to move the blog to a new server at 198.51.100.45 and update the record at 12:00.
- A resolver that last looked up the name at 11:50 cached the old answer with one hour to live, so it will keep returning 198.51.100.20 until 12:50.
- A resolver doing its first lookup at 12:05 gets the new address right away.
- A visitor whose resolver still holds the stale record reaches the old server until the cache expires.
This is why DNS changes are described as needing time to propagate. Nothing literally spreads across the world. Instead, scattered caches simply expire on their own schedules. A common trick before a planned change is to lower the TTL to a small value a day in advance, so caches turn over quickly when the real change lands.
DNS over HTTPS
Traditional DNS queries travel in plain text over the network, which means anyone between you and your resolver can see which names you look up, and in principle could tamper with the answers. DNS over HTTPS, abbreviated DoH, addresses the visibility problem by wrapping DNS queries inside an encrypted HTTPS connection to the resolver.
With DoH, an observer on the local network sees an ordinary encrypted web connection rather than a readable list of the domains you visit. Many modern browsers and operating systems can use DoH directly. The trade-offs are worth knowing: encryption hides your queries from the local network and your provider, but the resolver you send them to still sees every name you request, so the choice of resolver matters. DoH also does not hide the destination IP address your connection ultimately goes to, only the name lookup itself.
A related protocol, DNS over TLS, achieves similar privacy on a dedicated port rather than riding inside HTTPS.
Why the hierarchy is so resilient
The split between root, top-level domain, and authoritative servers is not just an organizational nicety. It is what makes DNS robust at internet scale. The root zone is small and changes rarely, so its data can be copied to hundreds of physical servers spread across the world using a technique called anycast, where many machines share the same address and the network simply routes you to the nearest one. That redundancy means a single failure, or even a large regional outage, does not take the root offline.
The same delegation model means responsibility is spread out. The operators of the .com zone never need to know the address of any individual website. They only need to know which name servers are authoritative for each registered domain. The domain owner, in turn, controls only their own records. No single party has to hold or update the entire internet's data, which removes the central bottleneck that a literal phone book would create.
This layering also explains why a misconfiguration usually affects only one domain rather than the whole system. If the authoritative server for one domain returns a wrong answer, every other domain keeps resolving normally, because each branch of the tree is independent.
What happens when a name does not exist
Not every lookup succeeds. When you query a name that has no record, the authoritative server returns a specific response known as NXDOMAIN, meaning the name does not exist. Resolvers cache these negative answers too, for a period controlled by a field in the SOA record, so a flood of requests for a missing name does not hammer the authoritative servers. This is why a typo in a domain name can sometimes keep failing briefly even after you correct the underlying record: the negative answer was cached. Understanding negative caching saves a lot of confusion when troubleshooting.
Common pitfalls
- Expecting instant changes. Because of TTL caching, a record change can take as long as the old TTL to be visible everywhere. Lower the TTL before planned changes.
- Pointing a CNAME at the apex. A CNAME cannot coexist with other records at the root of a domain, which causes errors if attempted.
- Forgetting the trailing dot. In raw zone files, a fully qualified name ends with a dot. Leaving it off can cause the domain to be appended unexpectedly.
- Blaming DNS for everything. Many connection problems look like DNS failures but are caused elsewhere. Use the dns-lookup tool to confirm what records actually resolve before assuming DNS is at fault.
With a clear picture of the resolution path, record types, and caching, DNS stops being mysterious and becomes a system you can reason about and troubleshoot.