How a DNS lookup works

When you type example.com, your device asks a resolver, usually your internet provider's or a public one. If the answer is not cached, the resolver walks down the hierarchy: root servers point to the .com servers, which point to the authoritative name servers for example.com, which return the IP address. The whole trip usually takes a few dozen milliseconds, and the answer is then cached.

Records you should know

  • A: maps the domain to an IPv4 address; AAAA does the same for IPv6.
  • CNAME: makes a subdomain an alias of another name, for example www pointing to your host's address.
  • MX: lists the servers that receive your email, each with a priority.
  • TXT: free text used for SPF, DKIM, DMARC and ownership checks (Google Search Console, Microsoft 365).
  • NS: names the authoritative name servers for the zone.
  • CAA: lists which certificate authorities may issue SSL certificates for the domain.

TTL and propagation

Every record has a TTL (time to live), in seconds, that tells resolvers how long they may cache it: 3,600 means one hour. "DNS propagation" is simply those caches expiring one by one. Before a migration, lower the TTL to 300 seconds at least a day ahead, and the switch will reach almost everyone within minutes.

Common mistakes

Deleting MX records when moving the website to a new host, which stops incoming email. Publishing two separate SPF records instead of one, which invalidates both. Putting a CNAME at the root of the domain, which the standard does not allow. Forgetting the www subdomain, so half your visitors hit an error page.