web dev//DNS//DNS record
A DNS record is one entry in a domain's zone that answers one kind of question about one name: which IPv4 address `api.example.com` has, which servers receive its mail, which text proves the domain belongs to its owner. The DNS is nothing but these records, held by the domain's nameservers and cached around the world.
A DNS record is one entry in a domain's zone that answers one kind of question about one name: which IPv4 address api.example.com has, which servers receive its mail, which text proves the domain belongs to its owner. The DNS is nothing but these records, held by the domain's nameservers and cached around the world.
Each record has a name, a type, a value and a TTL (time to live, how many seconds resolvers may cache the answer). The types an engineer meets in practice are few:
A and AAAA point a name at an IPv4 or IPv6 address, the direct answer to where is this machine.
CNAME makes a name an alias of another name (www pointing at example.netlify.app), so the address can change on the provider's side without touching the zone; it is not allowed on the bare apex.
MX names the mail servers and TXT carries free text, used for SPF, DKIM and the verification strings services ask for; together they are the email records.
NS declares which nameservers are authoritative for the zone or for a delegated subdomain, the record behind delegation.
A record says where a name lives; it never moves a visitor.
DNS answers with addresses, and sending a browser from one URL to another is the job of an HTTP redirect served by whatever the address points at.
The TTL is the lever for changes. A record cached for a day keeps sending part of the world to the old address for up to a day after it is edited; lowering the TTL to a few minutes a day before a migration makes the switch fast, and keeping the old server running until the old TTL has expired spares the visitors still sent there (propagation).
The record decides where traffic goes, never who owns the domain. Editing records needs access to the zone at the DNS provider; changing who answers the zone happens at the registrar, and ownership is the registrant's.
Records that nobody remembers (a forgotten subdomain for cameras, an old MX) are what breaks when a zone is rebuilt carelessly, which is why a migration starts with an export of every record.