DNS is the phonebook of the internet. Understanding how it works is essential for system design — from latency to failover to global load balancing.
DNS translates human-readable domain names into IP addresses.
techpaths.dev → DNS lookup → 76.76.21.21
This entire chain takes 20-120ms on first lookup. Subsequent lookups are served from cache.
| Record | Purpose | Example |
|---|---|---|
| A | Domain → IPv4 | techpaths.dev → 76.76.21.21 |
| AAAA | Domain → IPv6 | techpaths.dev → 2606::... |
| CNAME | Alias to another domain | www → techpaths.dev |
| MX | Mail server | → mail.google.com |
| TXT | Verification, SPF, DKIM | v=spf1 include:... |
| NS | Authoritative name servers | → ns1.cloudflare.com |
Before a migration: Lower TTL to 60s a day before, make the change, then raise it back.
Multiple servers share the same IP. Network routes each user to the nearest one.