Skip to content

DNS

The Domain Name System (DNS) is the Internet’s hierarchical, distributed database that maps Human-readable names to IP addresses and other resource data. DNS is arguably the most critical Infrastructure service on the Internet — virtually every application depends on name resolution to Function. When DNS fails, everything fails.

DNS was designed by Paul Mockapetris in 1983 (RFC 882 and RFC 883, now obsoleted by RFC 1034 and RFC 1035) to replace the original HOSTS.TXT file, which was a flat file maintained centrally and Distributed manually.

DNS is organized as a tree structure with the root at the top. Each node in the tree is called a domain and can have zero or more child domains.

graph TD
    ROOT["." (root)"]
    ROOT --> COM[".com"]
    ROOT --> ORG[".org"]
    ROOT --> NET[".net"]
    ROOT --> UK[".uk"]
    ROOT --> ARPA[".arpa"]
    COM --> EXAMPLE["example.com"]
    COM --> GOOGLE["google.com"]
    ORG --> WIKI["wikipedia.org"]
    NET --> CLOUD["cloudflare.net"]
    UK --> CO[".co.uk"]
    CO --> BBC["bbc.co.uk"]
    ARPA --> INADDR["in-addr.arpa"]
    ARPA --> IP6["ip6.arpa"]

    style ROOT fill:#4a6fa5,color:#fff
    style COM fill:#6a8caf,color:#fff
    style ORG fill:#6a8caf,color:#fff
    style NET fill:#6a8caf,color:#fff
    style UK fill:#6a8caf,color:#fff
    style ARPA fill:#6a8caf,color:#fff
  • Root zone (.): The top of the hierarchy. Managed by ICANN. Operated by 13 logical root server networks (A through M), implemented as anycast clusters with over 1,700 server instances worldwide.
  • Top-Level Domains (TLDs): Directly below the root. Includes generic TLDs (.com``.org .net``.dev) and country-code TLDs (.uk``.de``.jp``.au).
  • Second-Level Domains (SLDs): Registered by organizations and individuals (e.g., example.com google.com).
  • Subdomains: Delegated by the SLD owner (e.g., www.example.com``api.example.com us-east-1.api.example.com).

An FQDN specifies the exact location in the DNS tree, written with each label separated by a dot, Ending with the root (represented by a trailing dot, though omitted in practice):

www.example.com. (trailing dot is the root, usually implicit)

Labels are limited to 63 characters. The total FQDN length is limited to 253 characters. Labels are Case-insensitive (EXAMPLE.COM = example.com).

Operate the root zone, which contains delegations to all TLD name servers. There are 13 logical root Server networks (A-M), each identified by a letter and an IP address:

LetterOperatorIPv4IPv6
AVerisign198.41.0.42001:503:ba3e::2:30
BUSC/ISI199.9.14.2012001:478:65::53
CCogent192.33.4.122001:500:2::c
DMaryland199.7.91.132001:500:9d::d
FIANA192.5.6.302001:500:2f::f
JVerisign192.58.128.302001:503:c27::2:30
KRIPE NCC193.0.14.1292001:7fd::1
LICANN199.7.83.422001:500:9f::42
MWIDE202.12.27.332001:dc3::35

Each root server network operates anycast instances worldwide, so a query to “root server A” from Tokyo likely reaches a different physical server than from New York.

Authoritative for their TLD. The .com TLD servers know which name servers are authoritative for example.com``google.comEtc. They do not know the IP addresses — they only know which servers To ask next.

Hold the actual DNS records for a domain. When you register a domain, you configure its Authoritative name servers with your registrar. These are the servers that respond to DNS queries For your domain with definitive answers.

Authoritative name servers are further divided:

  • Primary (master): The authoritative source. Zone files are edited here.
  • Secondary (slave): Pull zone data from the primary via zone transfers (AXFR/IXFR). Provide redundancy and load distribution.

Perform the full resolution process on behalf of a client. When your laptop resolves www.example.comIt sends the query to a recursive resolver (configured via DHCP or manually). The Resolver walks the DNS hierarchy from the root down to the authoritative server, caching responses Along the way.

Common recursive resolvers:

  • Google Public DNS: 8.8.8.8``8.8.4.4
  • Cloudflare DNS: 1.1.1.1``1.0.0.1
  • Quad9: 9.9.9.9
  • ISP resolvers: Provided by your ISP, via DHCP

DNS records (resource records, RRs) map domain names to data. Each record has a type, class (almost Always IN for Internet), TTL, and data.

A (Address, RFC 1035): Maps a name to an IPv4 address.

example.com. 300 IN A 93.184.216.34

AAAA (IPv6 Address, RFC 3596): Maps a name to an IPv6 address.

example.com. 300 IN AAAA 2606:2800:220:1:248:1893:25c8:1946

CNAME (Canonical Name, RFC 1035): Alias of one name to another. DNS resolution continues at the Target name. A CNAME cannot coexist with any other record type on the same name.

www.example.com. 300 IN CNAME example.com.
cdn.example.com. 300 IN CNAME cdn.cloudflare.com.