DNS Record Types, and Which of Them May Share One Name
Technical
The DNS specification was published in November 1987. In July 1997 the same standards body published a second document whose only job was to say what the first one had meant, under the title Clarifications to the DNS Specification. Read it as a list of what people had got wrong, and two of its entries are about which record types are allowed to stand at a single name.
The question names a type
On its own, a name is not a question. A query is split into parts by the original specification, and the one that settles what comes back is the type: “QTYPE fields appear in the question part of a query.” A resolver asks for a name and a type together and receives the records of that type sitting at that name. The question’s vocabulary is the wider of the two, since “QTYPES are a superset of TYPEs, hence all TYPEs are valid QTYPEs.”
The type table in that document has sixteen entries, two of which it marks obsolete and four experimental. Five of them matter here: A, described there as a host address, CNAME, the canonical name for an alias, MX, a mail exchange, TXT, text strings, and PTR, a domain name pointer.
One name can hold several records of the same type. The 1987 text says so about addresses in a single line: “Hosts that have multiple Internet addresses will have multiple A records.” The second address family behaves the same way. RFC 3596, from October 2003, gives IPv6 a type of its own, AAAA, and states that a host “that has more than one IPv6 address must have more than one such record”, each of them “a record specific to the Internet class that stores a single IPv6 address”. So a machine reachable both ways has records of two types at one name. Which servers get asked for them, and in what order, is a separate subject, and it belongs to the route a question takes when nothing has the answer yet.
An alias leaves room for almost nothing else
The clarification document opens its section on record types by naming the belief it exists to correct. “It has sometimes been inferred from some sections of the DNS specification” that a host, or an interface of one, is permitted exactly one official name, it says, before answering flatly: “There is no such requirement in the DNS.”
What the alias type does is narrower than the belief it corrects, and its restriction is the one worth memorising. “There may be only one such canonical name for any one alias”, and the record carrying it crowds out almost everything else at the same name. The wording is careful about the exception. An alias name “may, if DNSSEC is in use, have SIG, NXT, and KEY RRs, but may have no other data.” Those three abbreviations belong to a signing scheme the document names and never describes, and what signing a record does and does not reach is the subject of its own specification set.
That resolves into a four-way rule, and the rule is the part to keep. For any name in the DNS exactly one of four things is true. Either an alias sits there, optionally with those signing entries beside it, or “one or more records exist, none being CNAME records”, or “the name exists, but has no associated RRs of any type”, or “the name does not exist at all”. No fifth state is available in which an alias shares a name with an address or a mail record.
The consequence arrives the moment you try to alias the top of a domain. A zone’s own apex necessarily carries other records, so by that rule an alias cannot sit there.
That section also corrects the vocabulary, which is worth knowing before reading somebody else’s zone file. Calling the left-hand side of such a record a CNAME is backwards, because “the label of a CNAME record is most certainly not a canonical name”. The document concedes the fight: “It is, however, an entrenched usage.”
Mail routing has to finish at an address
A mail exchange record has two fields and both are working. One is “the preference given to this RR among others at the same owner”, a sixteen-bit integer, and the original text adds the rule that catches a first-time reader of a zone file: “Lower values are preferred.” Its companion names “a host willing to act as a mail exchange for the owner name”.
That companion field is where the clarification bites. “The domain name used as the value of a NS resource record, or part of the value of a MX resource record must not be an alias”, and the requirement attached is positive rather than negative: “This domain name must have as its value one or more address records.” Other types are allowed to keep it company: “It can also have other RRs, but never a CNAME RR.”
The reason is a piece of plumbing that stays out of sight. A server answering a mail or name server query attaches the relevant addresses to its reply, which saves the asker a second round trip. The shortcut has a hole in it. “Additional section processing does not include CNAME records”, so “if an alias is used as the value of an NS or MX record, no address will be returned with the NS or MX value.” A zone built that way still resolves. It costs an extra query every time, and the document notes that in some hard cases a name server lookup can fail outright.
The 2003 extension widened that shortcut rather than replacing it, requiring the query types already attaching IPv4 addresses to be “redefined to perform both type A and type AAAA additional section processing”.
Text records have no fixed meaning
A later section of the same clarification corrects a larger assumption. “Occasionally it is assumed that the Domain Name System serves only the purpose of mapping Internet host names to data, and mapping Internet addresses to host names”, and the correction is that “the DNS is a general (if somewhat limited) hierarchical database, and can store almost any kind of data, for almost any purpose.”
One type was built for precisely that. Its 1987 definition runs to two sentences and the second settles the question: “TXT RRs are used to hold descriptive text. The semantics of the text depends on the domain where it is found.” Nothing inside the record says what it is for. The name it sits under does.
Sender policy records are where that openness shows its cost. Their specification, published in April 2014, notes that a dedicated type was tried and abandoned: “Use of alternative DNS RR types was supported in SPF’s experimental phase but has been discontinued.” Getting a new type assigned was harder then and support for new types was thin, so “developers of SPF found it easier and more practical to use the TXT RR type for SPF records”. The working group that revisited the question decided “significant migration to the SPF RR type in the foreseeable future was very unlikely” and dropped the dedicated type instead.
That document then warns its own successors off the shortcut it took: “SPF’s use of the TXT RR type for structured data should in no way be taken as precedent for future protocol designers.” What such a record establishes about a domain, as against what it establishes about any individual message, is what is being verified when a receiving server consults one.
Reading one type at a time
The pointer tool on this site asks for exactly one type. You do not get to choose which: it asks for the one type that answers in that branch of the namespace, so what you are reading is one kind of record rather than an inventory of everything published about the address. It is a query hard-wired to one type and nothing else, and what that single kind of record can and cannot tell you about a connection belongs to the type whose answers are indexed by address.
The page that reports on a single public number works the other way round. Give it one input and it returns the same fields every time, an approximate location, the provider, the autonomous system number, a hostname, a timezone and coordinates, whether or not you wanted all six. A DNS query has no such schema behind it. You name a type, you are handed that type, and whatever else is published at the same name stays unread until you ask for it separately. That is the difference between one input and a fixed set of fields back and a store you have to interrogate type by type.
Each document above can be read for nothing and the oldest of them dates from 1987. The restriction that does the damage is about company rather than content: which other types a name may keep at the same time, and which it may not.