Resource record

Also known as: DNS record

On this page 7

A resource record (RR), often called a DNS record, is the smallest unit of data in the Domain Name System: a single entry that associates an owner name with a typed piece of information, such as an IPv4 address, a mail server or a cryptographic key. Every answer a DNS resolver returns is made of one or more resource records.

All DNS records share one fixed structure, defined in RFC 1035, which is why a single format can carry dozens of record types. Understanding that structure, and the rules that govern how records are grouped, cached and signed, is the foundation for reading zone files, debugging resolution and designing reliable DNS configurations on the Internet.

The fields of a resource record

Every resource record consists of six fields, whether it appears in a zone file or travels inside a DNS message. In the wire format these fields appear in a fixed order, and RDATA is the only part whose layout changes with the record type.

The table below describes each field and its role.

FieldSize on the wireMeaning
Owner nameVariableDomain name the record belongs to
Type16 bitsKind of data, such as A, MX or TXT
Class16 bitsProtocol family, almost always IN for Internet
TTL32 bitsSeconds a cache may keep the record
RDLENGTH16 bitsLength of the data field in bytes
RDATAVariableType-specific payload, such as an address
Fields of a DNS resource record

In a zone file the same record is written in presentation format, for example www.example.com. 3600 IN A 192.0.2.10. Here the owner name is www.example.com., the TTL is 3,600 seconds, the class is IN, the type is A and the RDATA is the IPv4 address. The trailing dot marks a fully qualified name; omitting it makes the name relative to the zone origin, a common source of errors.

Common resource record types

The type field determines what a record means and how resolvers interpret its data. The IANA registry lists more than eighty types, but a small set covers nearly all everyday operations, while newer types support security and service binding.

TypeRDATA contentTypical use
A32-bit IPv4 addressMap a name to an IPv4 host
AAAA128-bit IPv6 addressMap a name to an IPv6 host
CNAMECanonical domain nameAlias one name to another
MXPreference value and host nameRoute email for a domain
NSName server host nameDelegate a zone to servers
SOAPrimary server, contact, serial, timersDescribe zone authority and refresh
TXTOne or more text stringsSPF, verification tokens, policies
SRVPriority, weight, port, targetLocate a service and its port
PTRDomain nameReverse mapping from address to name
Frequently used record types and their data

Security-related types extend the same model. DNSKEY, RRSIG, DS and NSEC records carry the keys, signatures and proofs used by DNSSEC, while HTTPS and SVCB records advertise connection parameters such as supported protocols before a client opens a connection.

Resource record sets and how they behave

Records that share the same owner name, class and type form a resource record set (RRset), and DNS treats the set, not the individual record, as the unit of transfer, caching and signing. A name with three A records therefore has one RRset of three members, which a server returns together.

Several rules follow from this grouping, and violating them produces errors that are hard to trace.

  • All records in an RRset should carry the same TTL; RFC 2181 deprecates mixed TTLs, and resolvers use the lowest one.
  • DNSSEC creates one RRSIG per RRset, so adding or removing a single record requires re-signing the whole set.
  • A CNAME cannot coexist with any other data at the same owner name, apart from DNSSEC records.
  • The order of records inside an RRset is not significant, which is the basis for simple round-robin load distribution.
  • Exact duplicate records are collapsed, because an RRset is defined as a set without duplicates.

Choosing TTL values for resource records

The TTL decides how long resolvers may serve a record from cache, so it is a direct trade-off between agility and load. A low TTL lets changes take effect quickly but increases query volume and dependence on authoritative servers; a high TTL improves resilience and speed but delays any correction.

The following decision table gives typical starting points; actual values depend on change frequency and failover design.

SituationTypical TTLReason
Stable NS and MX records1 to 2 daysRarely change, benefit from long caching
Ordinary web host A or AAAA1 hourBalances agility and query load
Planned migration window60 to 300 secondsLower in advance, restore afterward
DNS-based failover30 to 60 secondsClients must notice changes quickly
Domain verification TXT5 to 60 minutesShort-lived, checked once by a provider
Typical TTL choices by situation

A key detail is that lowering a TTL only helps after the old TTL expires. An operator who reduces a one-day TTL to five minutes must wait at least one day before the migration, or many caches will continue serving the old address.

Frequent mistakes with DNS records

Most resource record problems are configuration errors rather than protocol faults, and they tend to recur across organizations of every size.

MistakeEffectFix
CNAME at the zone apexConflicts with SOA and NS recordsUse A and AAAA, or a provider ALIAS
Missing trailing dotName expands to target.example.com.example.comWrite fully qualified names with a dot
MX pointing to a CNAMESome mail servers reject deliveryPoint MX to a name with A or AAAA
Multiple SPF TXT recordsSPF evaluation returns a permanent errorMerge into a single SPF string
SOA serial not increasedSecondary servers keep old dataIncrement the serial on every change
Resource record mistakes, effects and fixes

Diagnostic tools such as dig and kdig display records in presentation format, including the remaining TTL in a cache, which makes it straightforward to see whether a resolver holds stale data or the authoritative zone itself is wrong.

Put simply

The Domain Name System works like a huge address book, and each resource record is one line in that book. A line says which name it is about, what kind of information it holds, how long others may remember it, and the information itself.

One line might give a website’s numeric address, another might say where email for a company should go. Every DNS answer is built from these lines, so getting each one right is what keeps websites and email reachable.

In practice

A regional retailer moves its online shop from an old hosting provider to a new cloud platform. Two days before the switch, the administrator lowers the TTL on the shop’s A and AAAA records from 86,400 to 300 seconds, giving resolvers worldwide time to drop the long-cached values.

On migration night the administrator updates both records with the new addresses and increments the SOA serial number so the secondary name servers pick up the change. Within about five minutes most customers reach the new platform, and the old servers see traffic fall almost to zero within an hour. After a week of stable operation the TTL goes back to 3,600 seconds, reducing query load while keeping the migration downtime close to zero.