โ† Networking Fundamentals

DNS

~270 words ยท 2 min read

What DNS does

DNS (Domain Name System) translates human-readable names like example.com into machine addresses like 93.184.216.34. Without it, you'd memorize IP numbers for every site.

The domain hierarchy

A domain is read right to left, from most general to most specific:

blog.shop.example.com
 |    |    |       |
 TLD  2nd   3rd    hostname

The root (.) and TLD (.com) sit at the top. Each level delegates to the one below it.

How a lookup works

  1. Your OS asks a recursive resolver (usually your ISP's, or a public one like 1.1.1.1).
  2. The resolver queries the root servers, then the TLD servers, then the authoritative server for the domain.
  3. The authoritative server returns the record, and the resolver caches it.
Resolvers cache answers for the record's TTL. That's why a DNS change can take minutes โ€” or hours โ€” to propagate: old answers linger in caches worldwide.

Record types

  • A โ€” maps a name to an IPv4 address.
  • AAAA โ€” maps a name to an IPv6 address.
  • CNAME โ€” aliases one name to another.
  • MX โ€” where to deliver email for the domain.
  • TXT โ€” arbitrary text, used for verification and SPF/DKIM.

TTL

TTL (Time To Live) is how many seconds a resolver may cache the record before re-checking. A 3600 TTL means "trust this for an hour."