DNS: from a name to an address
Before any connection, a name must become an address. Learn the resolution chain, why caches make DNS fast and stale at once, and what HTTPS records add in 2026.
The Domain Name System is a distributed database that maps names such as api.example.com to records such as IP addresses. No single server holds everything. Authority is delegated down a tree: the root knows who runs .com, the .com servers know who runs example.com, and example.com's own servers answer for its names.
One lookup, four servers, many caches
Record types you will meet
| Type | Holds | Example |
|---|---|---|
| A / AAAA | IPv4 / IPv6 address | api.example.com A 203.0.113.7 |
| CNAME | An alias to another name | www CNAME example.cdn.net |
| MX | Mail servers | example.com MX 10 mail.example.com |
| TXT | Free text, often verification | "v=spf1 include:_spf.example.net ~all" |
| NS | Which servers are authoritative | example.com NS ns1.dnshost.net |
| HTTPS / SVCB | Connection hints: ALPN protocols, ports, address hints | HTTPS 1 . alpn="h3,h2" |
Caching and TTLs
Every record carries a time to live in seconds. Resolvers cache the answer for that long. A TTL of 300 means a change can take up to five minutes to be seen by everyone, and longer when software ignores TTLs. Low TTLs make failover faster but send more queries; high TTLs are cheaper and slower to change.
# Ask your configured resolver; note the TTL column and the query time
dig api.example.com
# Walk the delegation from the root yourself
dig +trace api.example.com
# See whether a site advertises HTTP/3 through an HTTPS record
dig cloudflare.com HTTPS +shortRun dig twice. The second answer usually shows a lower TTL and a query time near 0 ms: it came from cache.
- Stub → recursive resolver
- 1 round trip to your ISP or a public resolver, ~10 ms
- Recursive → root (often cached)
- 0 to 1 round trip
- Recursive → .com servers (often cached)
- 0 to 1 round trip, ~20 ms
- Recursive → authoritative
- 1 round trip, 20 to 100 ms
A cold lookup can add 50 to 150 ms before the first TCP packet. A warm one costs almost nothing, which is why a harness should reuse connections and let the OS cache.
Go deeperPrivate and modern DNS: DoH, DoT and HTTPS records
Classic DNS travels over unencrypted UDP port 53, so anyone on the path can see and alter which names you look up. DNS over TLS (port 853) and DNS over HTTPS wrap queries in encryption. Browsers commonly use DoH to a trusted resolver.
HTTPS records let a site advertise how to connect before the first packet: supported protocols such as h3, alternative ports, IP hints and keys for Encrypted Client Hello. A browser that sees alpn="h3" can try HTTP/3 on the very first connection instead of learning it from an Alt-Svc header after a TCP connection (Module 5).
Where you will meet it
Moving traffic to a standby region by changing DNS takes effect only as caches expire. Teams lower TTLs before planned migrations.
Kubernetes gives every service a DNS name. Misconfigured search domains can turn one lookup into five failed queries first.
When a large DNS provider fails, sites that are perfectly healthy become unreachable, because nobody can find their address.
Words to know
- Stub resolver
- The small resolver in your OS that forwards questions to a recursive resolver.
- Recursive resolver
- A server that finds answers on your behalf by walking the DNS tree and caching results.
- Authoritative server
- A server that holds the true records for a domain.
- TTL (DNS)
- How long, in seconds, a record may be cached.
Check yourself
Answer out loud before you open each one.
What does a recursive resolver do on a cold cache?
It walks the delegation: root servers, then the top-level domain's servers, then the domain's authoritative servers, caching each answer.
Why might a DNS change take a long time to be seen?
Resolvers cache records for their TTL, and some clients cache longer than the TTL.
What does an HTTPS DNS record add?
Connection hints before connecting, such as supported protocols including HTTP/3, ports and address hints.
Try it
Run dig +trace on a domain you use daily. Count the servers involved, then run plain dig twice and compare the query times.