Reference notes.
DNS (Domain Name System) translates human-readable domain names to IP addresses. It’s the phonebook of the internet.
How DNS Resolution Works
- Local cache - Browser/OS checks local cache
- Recursive resolver - Query sent to ISP or configured resolver (e.g., 8.8.8.8)
- Root servers - Resolver queries root (
.) for TLD location - TLD servers - Returns authoritative nameserver for domain
- Authoritative server - Returns the actual record
- Response cached - Result cached based on TTL
User -> Resolver -> Root -> TLD (.com) -> Authoritative (example.com) -> IP
Record Types
| Type | Purpose | Example |
|---|---|---|
| A | IPv4 address | example.com. 300 IN A 192.0.2.10 |
| AAAA | IPv6 address | example.com. 300 IN AAAA 2001:db8::10 |
| CNAME | Alias to another name | www.example.com. CNAME example.com. |
| MX | Mail server | example.com. MX 10 mail.example.com. |
| TXT | Text data (SPF, DKIM, verification) | example.com. TXT "v=spf1 ..." |
| NS | Nameserver delegation | example.com. NS ns1.example.com. |
| SOA | Start of Authority (zone metadata) | Serial, refresh, retry, expire, TTL |
| PTR | Reverse DNS (IP to name) | 10.2.0.192.in-addr.arpa. PTR example.com. |
| SRV | Service location | _sip._tcp.example.com. SRV 10 5 5060 sip.example.com. |
| CAA | Certificate Authority authorisation | example.com. CAA 0 issue "letsencrypt.org" |
| HTTPS | Service binding and parameters (RFC 9460) | example.com. HTTPS 1 . alpn="h2,h3" |
Zone apex and HTTPS records: Standard CNAME records cannot coexist with other record types (NS, SOA), so they are forbidden at the zone apex (e.g., example.com). DNS providers work around this with CNAME flattening / ALIAS / ANAME records, or with the standards-based HTTPS record (RFC 9460), which supports apex aliasing (HTTPS 0 target.example.net.) alongside service parameters such as HTTP/3 ALPN hints (alpn="h2,h3") and Encrypted Client Hello (ECH) public keys (ech=...).
TTL (Time To Live)
- Duration (seconds) a record can be cached
- Lower TTL = faster propagation, more queries
- Higher TTL = better performance, slower changes
- Common values: 300 (5 min), 3600 (1 hour), 86400 (1 day)
Tip: Lower TTL before making changes, then raise it after.
CLI Tools
dig- Recommended, full-featured DNS lookupnslookup- Cross-platform, simpler outputhost- Quick lookups
Key dig options: +short (brief output), +trace (show resolution path), -x (reverse lookup), @server (query specific nameserver)
Public DNS Resolvers
| Provider | Primary | Secondary |
|---|---|---|
| Cloudflare | 1.1.1.1 | 1.0.0.1 |
| 8.8.8.8 | 8.8.4.4 | |
| Quad9 | 9.9.9.9 | 149.112.112.112 |
Encrypted DNS
Traditional DNS queries are sent in plaintext over UDP port 53, falling back to TCP port 53 for truncated/large responses (such as DNSSEC responses exceeding EDNS0 limits) and zone transfers (AXFR/IXFR). Modern encrypted DNS protocols prevent eavesdropping and tampering between the client and recursive resolver.
| Protocol | Transport | Port | Notes |
|---|---|---|---|
| DoH (DNS over HTTPS) | HTTPS | 443 | Blends with web traffic, hard to block. Widely supported in browsers. |
| DoT (DNS over TLS) | TLS | 853 | Dedicated port, easier to identify and block. |
| DoQ (DNS over QUIC) | QUIC | 853 | Combines DoT’s dedicated port with QUIC’s performance benefits (0-RTT, no head-of-line blocking). RFC 9250. |
All three major public resolvers (Cloudflare, Google, Quad9) support DoH and DoT (Cloudflare 1.1.1.1 also supports DoH3 and Oblivious DoH, though not native RFC 9250 DoQ). Native DoQ support is growing — Quad9 launched global DoQ in March 2026 alongside AdGuard DNS, NextDNS, and Mullvad.
DNSSEC
While encrypted DNS protects the client-to-resolver hop, DNSSEC cryptographically authenticates DNS records from the authoritative zone to prevent spoofing and cache poisoning:
DNSKEY— Publishes a zone’s public signing keys (Zone Signing Key / Key Signing Key)RRSIG— Cryptographic signature over each record set in the zoneDS(Delegation Signer) — Hash of a child zone’s key stored in its parent zone (e.g.,.comholds theDSrecord forexample.com)- Chain of trust — Validating resolvers trace signatures from the root trust anchor through the TLD to the authoritative record; broken signatures or expired keys return
SERVFAIL
Self-Hosted DNS Options
- Pi-hole - Network-wide ad blocking via DNS sinkholing
- Unbound - Validating, recursive, caching resolver
- dnsmasq - Lightweight DNS forwarder and DHCP server
Common Issues
- Propagation delay - TTL-based caching, wait for expiry
- NXDOMAIN - Domain doesn’t exist
- SERVFAIL - Server error (often DNSSEC issues)
- Cached stale records - Flush local DNS cache
See Also
- HTTP — HTTPS records advertise HTTP/3 (
alpn="h2,h3") via DNS - TLS — CAA records authorise CAs; HTTPS records publish ECH keys; certificates are validated against domains
- DHCP — DHCP distributes resolver addresses to clients
- Container Networking — Kubernetes uses CoreDNS for internal service discovery
- VPNs — DNS leaks bypass the tunnel and reveal browsing activity