ConceptDifficulty: Beginner2 min

DNS Records: A, AAAA, CNAME, MX, TXT and NS

A record says what a name points to, and its type says what kind of thing that is.

A DNS record is one fact about a name, and its type says what kind of fact it is: an address, another name, a mail server or a piece of text. A domain's records together are its zone, written in a zone file one record per line: the name, the TTL in seconds, the class (almost always IN, for internet), the type and the value.

Common record types, what each holds, and an illustrative record from the example.com zone
TypeHoldsExample record
AAn IPv4 addressexample.com. 3600 IN A 203.0.113.10
AAAAAn IPv6 addressexample.com. 3600 IN AAAA 2001:db8::10
CNAMEAn alias: this name is another namewww.example.com. 3600 IN CNAME example.com.
MXA mail server for the domain, with a priorityexample.com. 3600 IN MX 10 mail.example.com.
TXTFree text, often a verification token or mail policyexample.com. 3600 IN TXT "v=spf1 -all"
NSThe authoritative servers for the zoneexample.com. 86400 IN NS ns1.example.net.

A few rules decide how they are used.

A and AAAA are the answers a browser wants. A name can have several of each, and clients try them in turn or spread their connections across them.

A CNAME replaces everything at its name. It says "this name is really that one", so a resolver asking for any type at www.example.com follows the alias and asks again for example.com. Because of that, a name with a CNAME may hold no other records at all: no MX, no TXT, nothing. This is why CNAMEs suit names like www or a hosted service's subdomain, and cause trouble at the root of a domain.

MX names a host, not an address. Mail servers look up the MX for the part after the @ in an email address, then the A or AAAA record for the host it names. The number is a priority: lower is tried first.

TXT carries text for other systems. Mail providers check TXT records for sending policies, and services ask a domain owner to publish a TXT token to prove they control it.

NS records delegate. The parent zone, .com here, holds NS records pointing to example.com's servers, which is how the referrals in a lookup work.

So when adding a record, decide first what kind of answer the name should give, an address, another name or mail, and the type follows.