DNS, the Domain Name System, is the naming layer that lets people use names such as stack-shade.github.io instead of remembering numeric IP addresses. It looks simple at the browser level, but DNS is a distributed, cached hierarchy designed to scale to an enormous number of queries.
Why DNS exists
Humans prefer stable names while networks need routable addresses. DNS decouples the two. A domain can move between servers or CDNs while the public name remains the same, as long as DNS records are updated.
The hierarchy
DNS is organized from right to left. The root zone delegates to top-level domains such as .com, .org, and country-code TLDs. A TLD then points queries toward authoritative name servers for a specific domain.
Recursive vs authoritative servers
Your device usually talks to a recursive resolver. The resolver performs work on your behalf and caches answers. Authoritative servers are the source of truth for a domain's records. This separation keeps end-user queries fast while distributing responsibility across the hierarchy.
Step-by-step resolution
- The browser and operating system check local caches.
- If necessary, the configured recursive resolver is queried.
- The resolver asks a root server where to find the relevant TLD.
- The TLD server points the resolver to the domain's authoritative servers.
- The authoritative server returns a record such as A or AAAA.
- The resolver caches the result for its TTL and returns it to the client.
Important record types
An A record maps a hostname to an IPv4 address, whileAAAA is used for IPv6. CNAME creates an alias to another hostname. MX controls mail delivery.TXT stores text used for many verification and policy mechanisms, including email authentication.
What TTL really changes
Every cacheable DNS answer can have a time-to-live. A shorter TTL lets changes propagate through caches sooner but can increase resolver traffic. A longer TTL reduces query volume but means changes may remain cached longer.
DNS and CDNs
DNS is often part of traffic steering. A CDN can answer a hostname with an edge address chosen according to geography, availability, load, or network policy. This is one reason a single domain can serve users from different physical locations.
Useful debugging commands
dig example.com
dig A example.com
dig AAAA example.com
dig +trace example.com
nslookup example.comThe +trace command is especially useful for learning because it shows the delegation chain instead of hiding it behind a recursive resolver.
Common failure modes
- A missing or incorrect record can produce NXDOMAIN or other resolution errors.
- Stale cached answers can make a recently changed domain appear inconsistent.
- DNS may be healthy while the actual server, TLS configuration, or HTTP layer is failing.
Related reading
Once DNS makes sense, the next step is understanding the rest of the request path. Continue withwhat happens when you type a URLor compareHTTP/1.1, HTTP/2, and HTTP/3.