DNS in Practice

Learn how names turn into addresses, which record types you will manage, and why DNS is behind so many surprising outages.

Beginner · about 5 hours · difficulty 2/5

Learn first: How the Internet Works: TCP/IP and the OSI Model

DNS translates names like api.example.com into IP addresses. It is a hierarchical, cached, distributed database, and a surprising share of incidents come down to a DNS change, a TTL, or a resolver misbehaving.

How resolution works

Your machine asks a recursive resolver (your ISP, 1.1.1.1, or the VPC resolver). The resolver walks from the root servers to the TLD (.com) servers to the domain's authoritative name servers, then caches the answer for the record's TTL.

Records you will manage

  • A / AAAA: name to IPv4 / IPv6.
  • CNAME: alias to another name (not allowed at the zone apex; providers offer ALIAS/ANAME records instead).
  • MX mail, TXT (domain verification, SPF, DKIM), NS delegation, SRV, CAA (which CAs may issue certificates).

Operations

  • Lower the TTL a day before a migration so the cut-over propagates quickly.
  • Managed DNS: Route 53, Cloud DNS, Azure DNS, Cloudflare. Manage records as code.
  • Inside Kubernetes, CoreDNS gives services names like svc.namespace.svc.cluster.local.

Tools and pitfalls

dig +trace example.com, dig @8.8.8.8 example.com A, nslookup, and /etc/resolv.conf. Watch out for negative caching, split-horizon DNS (different answers inside and outside the VPC), and apps that cache DNS forever.

Good enough to move on: you can trace a lookup with dig, pick the right record type for any need, and plan a zero-downtime DNS cut-over.

Key concepts

  • Recursive vs authoritative resolvers
  • A, AAAA, CNAME, MX, TXT, NS
  • TTL and caching
  • dig and nslookup
  • Managed DNS services
  • Split-horizon and private zones
  • DNSSEC

Mini project

Register a cheap domain or use a free subdomain, point it at a VM with an A record, add a CNAME for www and a TXT record, then trace resolution with dig +trace and document what each hop returned.

Check yourself

You changed an A record an hour ago but some users still hit the old server. What are the likely reasons?

Free resources