DNS

Domain Name System — the distributed directory that maps names to addresses

What is DNS?

DNS — the Domain Name System — is the internet's distributed, hierarchical phone book. Every time you type a hostname into a browser, curl, or SSH, DNS translates that human-readable name into the IP address the network actually needs to route your packets.

Designed by Paul Mockapetris and published in RFC 1034/1035 in 1987, DNS replaced the single centralized HOSTS.TXT file that had been manually distributed to every host on ARPANET. It is now the largest distributed database in the world, answering trillions of queries per day with no single point of control.

Key Concepts

UDP/53
Primary transport (TCP for large responses)
13
Root name server clusters (A–M)
TTL
Time To Live — seconds a record may be cached
RR
Resource Record — the fundamental data unit
FQDN
Fully Qualified Domain Name — ends with a trailing dot
Zone
A contiguous portion of the namespace under one authority

DNS Hierarchy

. (root — 13 clusters, operated by ICANN, VeriSign, RIPE, etc.)
├── com. (gTLD — operated by VeriSign)
│ ├── google.com. (authoritative zone — Google's nameservers)
│ │ ├── www.google.com.
│ │ └── mail.google.com.
│ └── ximg.com.
├── net. (gTLD — operated by VeriSign)
├── org. (gTLD — operated by Public Interest Registry)
└── app. (gTLD — operated by Google)
└── ximg.app. (authoritative zone — this server)
├── dns.ximg.app.
└── linux.ximg.app.

Caching Layers

A DNS query rarely reaches an authoritative server. Before hitting the network, it passes through several cache layers, each with its own TTL budget: the browser's internal DNS cache, the OS stub resolver, the local recursive resolver (often your router or ISP), and finally the authoritative nameserver. Each hop that has a cached answer stops the chain and returns immediately.

Negative caching (NXDOMAIN responses) is also stored for the duration of the SOA record's minimum TTL, preventing repeated lookups for names that do not exist.