Kahibaro
Discord Login Register

12.4 DNS Record Types

Introduction

DNS record types describe the different kinds of information that DNS can store and provide about a domain name. When a DNS server answers a query, it does not just say "this name exists." It returns a specific type of record, such as "this name maps to an IPv4 address" or "send mail for this domain to this server."

This chapter focuses on the ideas common to all DNS record types and the relationships between them. Detailed explanations of individual types like A, AAAA, CNAME, MX, and TXT will appear in their own chapters, so they are only briefly referenced here.

What Is a DNS Record?

A DNS record is a structured piece of data stored in a DNS zone. It links a domain name, such as example.com or mail.example.com, to some value, such as an IP address, another name, or a configuration string.

Every DNS record has at least these fields:

FieldMeaning
NameThe domain or subdomain the record applies to
TypeThe record type, such as A, AAAA, CNAME, MX, TXT
ClassUsually IN for Internet in almost all modern DNS use
TTLTime To Live, how long the record can be cached (in seconds)
Data (RDATA)The record specific information, for example an IP, name, or priority

A simple example in a zone file style format is:

www.example.com. 3600 IN A 203.0.113.10

Here, www.example.com. is the name, 3600 is the TTL in seconds, IN is the class, A is the type, and 203.0.113.10 is the data.

Resource Record Sets and Multiple Answers

DNS is designed to allow multiple records of the same type for the same name. All records that share the same name, type, and class form a resource record set, often abbreviated as RRset.

For example, www.example.com may have several IPv4 addresses:

NameTTLClassTypeData
www.example.com.300INA203.0.113.10
www.example.com.300INA203.0.113.11
www.example.com.300INA203.0.113.12

These three A records together make up one RRset. A DNS response for A records for www.example.com can contain all three of them, and the client can choose one to use. This is often used for load distribution and basic redundancy.

Some record types are commonly used in sets, for example multiple MX records for mail servers or multiple NS records for name servers.

Names, FQDNs, and Relative Records

DNS record types are always attached to a name. That name can be written as a fully qualified domain name, or FQDN, which ends with a dot, or as a relative name inside a zone file.

In configuration, you might see:

www 300 IN A 203.0.113.10

if the zone is already defined as example.com.. In that case, the full name is www.example.com.. In protocol messages, names are treated as fully qualified, even if human friendly tools often omit the final dot.

Understanding the exact name a record applies to is important, because different types can target different names inside the same domain.

How Record Types Fit Together

A typical domain uses multiple record types together to provide different services. For example, a simple web and mail domain might have:

NameTypePurpose
example.com.AMain IPv4 address for the domain
example.com.AAAAMain IPv6 address
www.example.com.CNAMEAlias pointing to example.com.
mail.example.com.AIPv4 address of the mail server
example.com.MXMail delivery target, mail host
example.com.TXTVarious text based settings

Each record type answers a different question. Some examples of questions are, "What IP addresses belong to this host name?" or "Which servers receive mail for this domain?" or "What extra configuration is attached to this domain?"

DNS does not limit a name to only one type, so a name can have an A record and a TXT record at the same time. One common rule is that a name should not have both a CNAME record and other record types at the same time, which is covered in detail in the chapter that discusses CNAME.

Important rule: A single DNS name can have multiple records of the same type and also different types, but there are strict rules for specific types such as CNAME that must not be combined with other records at the same name.

TTL and Caching of Different Types

The TTL field applies to each DNS record, and therefore to each record type, individually. When a resolver receives an answer, it caches it for up to TTL seconds. Shorter TTLs mean more frequent refreshes and more flexibility, but more DNS traffic. Longer TTLs mean more stable caching and less traffic, but slower changes if you update a record.

You can use different TTLs for different record types:

RecordTTLReason
A for www.example.com300Web hosting IPs may change
MX for example.com3600Mail servers are more stable
NS for example.com86400Name servers rarely change

Different types can therefore have different change behaviors in the network. Clients will obey these TTLs per record type and per RRset.

Answer, Authority, and Additional Sections

Although the DNS protocol is discussed elsewhere, it is useful here to understand where different record types appear in a response. A DNS response can contain records in three main sections:

SectionWhat it holds
AnswerRecords that directly answer the question
AuthorityNS or SOA records that describe which servers are in charge
AdditionalExtra records that are useful to the client, often A/AAAA

When you ask for a particular type, for example MX, the answer section will contain MX records. The additional section may include A or AAAA records for the mail servers that the MX records point to. This behavior reduces the number of separate queries the client must make, and it relies on how different record types relate to each other.

Data Content by Type

Even though each record has the same general structure, the data field, often called RDATA, has a different shape depending on the record type. It is useful to think of each type as answering one narrow question:

TypeQuestion it answersData kind
AWhat is the IPv4 address for this host name?32 bit IPv4 address
AAAAWhat is the IPv6 address for this host name?128 bit IPv6 address
CNAMEWhat is the canonical name for this alias?Another domain name
MXWhich server(s) should receive mail for this domain?Preference number and mail server name
TXTWhat text information is attached to this name?One or more character strings

The exact format and use of these fields are explained in the later chapters on each record type, especially for MX and TXT where the structure has more detail and common conventions.

Priorities and Order Among Records

Some record types include an explicit priority inside their data. MX records, for instance, combine a number with a host name. The number expresses priority, which clients use to choose which server to try first.

In other situations, order is not directly encoded in the data but is instead left to the client. For example several A records for the same name have no explicit priority field. Clients may use different strategies to select one of them, such as simple rotation, random choice, or custom logic.

This difference is not a property of DNS in general, but a property of each record type.

Important rule: Do not assume that the order in which multiple records are returned is a guaranteed priority. Some record types include an explicit preference field, such as MX, while others, such as A and AAAA, do not.

Special Types and Extensibility

DNS was designed to be extensible. New record types can be added over time to support new use cases. Historical examples include records to support security, key distribution, and various application specific configurations.

Because of this, software that works with DNS needs to be able to handle unknown types gracefully. If a resolver or client sees a record with an unfamiliar type code, it should still handle the message correctly, even if it ignores the record content.

From your point of view as a network beginner, this means that the set of DNS record types you learn first is not the complete set that exists, but it is enough to understand and troubleshoot most real networks.

Choosing Appropriate Record Types

When configuring DNS for a service, you choose a record type based on the question that clients will ask. If you want web browsers to find your server by name, you provide address records. If you want mail servers to know where to deliver mail, you provide mail exchange records. If an application expects configuration expressed as text, you may use text records.

Common choices include using A and AAAA records to map host names to IP addresses directly, placing an alias in a CNAME record to avoid duplicating IPs across names, and using TXT records for service related information such as verification tokens or policy declarations.

The rest of this section of the course explores the main record types in detail. Each of the following chapters focuses on one type and explains its typical use, common mistakes, and how it interacts with other types in the DNS system.

Views: 48

Comments

Please login to add a comment.

Don't have an account? Register now!