Skip to the workspace
Pebellslearn by building
Networking & Protocols  ›  Lesson

DNS — Names to Addresses

DNS 12 minDNS maps names to records such as A, AAAA, CNAME and MX through resolvers and authoritative servers, and every answer is cached for the record's TTL.

devops / DNS — Names to Addresses

Explore each scene at your own pace.

01 · The rule

The rule

DNS — Names to Addresses

You move notes-api to a new server and update the DNS record. Your laptop sees the new server; a colleague's still hits the old one for an hour. Nothing is broken: that is DNS caching doing exactly what it was told.

The rule

DNS turns names into records, and every answer is cached for its TTL.

The Domain Name System is a distributed database of records attached to names. The ones you will use most:

Record Maps a name to Example
A an IPv4 address notes.example.com → 203.0.113.10
AAAA an IPv6 address notes.example.com → 2001:db8::10
CNAME another name (an alias) www.example.com → example.com
MX the mail servers for a domain example.com → mail.example.com
TXT free text, often for verification and email policy
NS the name servers responsible for a domain

How a lookup works: your machine asks a recursive resolver (from your ISP, company, or a public one). If the resolver has no cached answer, it asks a root server, which points to the .com servers, which point to the domain's authoritative name servers, which give the real answer. The resolver then caches it for the record's TTL (time to live, in seconds).

dig notes.example.com +short           # just the answer
dig notes.example.com                  # full answer, including the TTL
dig @1.1.1.1 notes.example.com         # ask a specific resolver
dig example.com MX +short              # a specific record type
Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.