DNS Record Types: A, AAAA, CNAME, MX, NS, SOA, PTR, TXT, SRV, CAA, SVCB and HTTPS
The DNS record types you meet in practice, each queried from a lab zone: addresses, NS and glue, SOA fields, CNAME and DNAME aliases, wildcards, reverse lookups for IPv4 and IPv6 with classless delegation, MX and null MX, TXT, SRV, NAPTR and URI, CAA, SVCB and HTTPS, and minimal ANY responses.
kvi5hnuCode Sprout team member17 min readOn this page
A DNS zone is a collection of resource records, each with a name, a type, a TTL and type-specific data. There are dozens of record types in the IANA registry, but a small set does most of the work. This article goes through them, querying each one from the lab's example.com zone, and covers the rules that trip people up: where CNAMEs are allowed, how reverse names are built, and what the newer SVCB and HTTPS records add.
Types fall into three groups. Data types are stored in zones: A, MX, TXT and the rest. Query types can appear only in questions: AXFR and IXFR for zone transfers (article 53) and ANY (*). Meta types exist only in messages, such as the OPT record (article 51) and the TSIG (transaction signature) record that authenticates messages (article 53).
A and AAAA: addresses
An A record (type 1) holds a 32-bit IPv4 address. An AAAA record ("quad-A", type 28) holds a 128-bit IPv6 address. A name can have several of each, forming an RRset:
www.example.com. 3600 IN A 198.51.100.10
www.example.com. 3600 IN AAAA 2001:db8:2::10
A dual-stack client asks for both types, usually in parallel, and then chooses which address to connect to using address selection rules and Happy Eyeballs (RFC 8305), which races IPv6 and IPv4 connections so a broken IPv6 path doesn't stall the user.
NS and glue
NS records (type 2) list a zone's authoritative servers by name, both at the zone's own apex and as a delegation in the parent:
example.com. 3600 IN NS ns2.example.com.
example.com. 3600 IN NS ns1.example.com.
NS records must point to names that have address records, never to a CNAME, and never to an IP address directly. When a server's name is inside the zone it serves, as ns1.example.com serves example.com, the parent must also hold the server's address as glue (article 49).
SOA: start of authority
Every zone has exactly one SOA record (type 6), at its apex. dig +multiline labels its fields:
example.com. 3600 IN SOA ns1.example.com. hostmaster.example.com. 2026112101 7200 900 1209600 300
2026112101 ; serial
7200 ; refresh (2 hours)
900 ; retry (15 minutes)
1209600 ; expire (2 weeks)
300 ; minimum (5 minutes)
)
- MNAME (
ns1.example.com.): the primary server for the zone. - RNAME (
hostmaster.example.com.): the administrator's mailbox, with the first dot standing for@, so this meanshostmaster@example.com. - Serial: the zone's version number. Secondaries compare it to decide whether to fetch a new copy (article 53), so it must increase with every change. A common convention is
YYYYMMDDnn, as here: November 21, 2026, change 01. Comparisons use serial number arithmetic (RFC 1982), which lets the value wrap around 2³² safely. - Refresh: how often secondaries check the serial (2 hours here).
- Retry: how soon to try again if the check fails (15 minutes).
- Expire: how long a secondary keeps serving the zone without reaching the primary before giving up (2 weeks).
- Minimum: today, the TTL for negative answers (article 50). Its original meaning, a default TTL for records, was replaced by RFC 2308 and the zone file
$TTLdirective.
CNAME: aliases
A CNAME record (type 5) says that a name is an alias for another, canonical name. A resolver that finds a CNAME restarts the lookup with the target and includes the whole chain in the answer:
blog.example.com. 3600 IN CNAME shop.example.com.
shop.example.com. 3600 IN CNAME www.example.com.
www.example.com. 3600 IN A 198.51.100.10
blog points to shop, which points to www, which has the address. Chains work, but each step can mean another lookup, so keep them short. The alias applies to every type: asking for blog's MX record follows the chain too, and ends with an empty answer because www has no MX:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 56644
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 1, ADDITIONAL: 1
blog.example.com. 3600 IN CNAME shop.example.com.
shop.example.com. 3600 IN CNAME www.example.com.
CNAMEs have two strict rules that cause many configuration errors:
- A name with a CNAME can have no other records (RFC 1034, RFC 2181), except DNSSEC records. You can't have
shopbe a CNAME and also have an MX record. - Because of that, the zone apex can't be a CNAME: the apex must have SOA and NS records. So
example.comitself can't be an alias forexample.cdn.example.net, a name at a CDN (content delivery network, a company that serves sites from many locations). DNS providers work around this with non-standard "ALIAS", "ANAME" or "CNAME flattening" features, which resolve the target themselves and serve A and AAAA records. The HTTPS record, below, offers a standard solution.
DNAME: aliasing a whole subtree
A DNAME record (type 39, RFC 6672) redirects every name below its owner to the same position under another domain. The lab has old.example.com DNAME example.net.:
old.example.com. 3600 IN DNAME example.net.
www.old.example.com. 3600 IN CNAME www.example.net.
www.example.net. 3600 IN CNAME www.example.com.
www.example.com. 3600 IN A 198.51.100.10
The server synthesized a CNAME from www.old.example.com to www.example.net, which itself is a CNAME to www.example.com. DNAME is used for renamed organizations and for some reverse zones. It doesn't redirect the owner name itself, only names below it.
Wildcards
A record whose leftmost label is * matches names that don't otherwise exist below its parent (RFC 4592). The zone has *.apps.example.com A 198.51.100.80:
anything.apps.example.com. 3600 IN A 198.51.100.80
deeper.name.apps.example.com. 3600 IN A 198.51.100.80
status: NOERROR
Both anything.apps and the deeper deeper.name.apps matched. apps.example.com itself exists as an empty non-terminal (it has a child), so it returned NOERROR with no data, not the wildcard. A wildcard also doesn't match a name that exists with other types. Wildcards are convenient for platforms that give each customer a subdomain, but they make typos resolve successfully, which can hide mistakes.
PTR: reverse lookups
Finding the name for an address uses PTR records (type 12) in special domains under arpa.

For IPv4, the address bytes are reversed, because DNS names go from specific to general but addresses go from general to specific, and in-addr.arpa is appended. dig -x builds the name for you:
10.100.51.198.in-addr.arpa. 3600 IN PTR www.example.com.
;10.100.51.198.in-addr.arpa. IN PTR
For IPv6, each of the 32 hex digits becomes its own label, in reverse order, under ip6.arpa (RFC 3596):
;0.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa. IN PTR
0.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa. 3600 IN PTR www.example.com.
Reverse zones are delegated along address boundaries: your ISP or regional Internet registry delegates the reverse zone for your prefix to your servers. IPv6's 4-bit labels allow delegation at any multiple of 4 bits, such as a /48 or a /56.
Nothing guarantees that a PTR record exists, or that it matches the forward records. Mail servers commonly check forward-confirmed reverse DNS: the PTR for the connecting address must name a host whose A or AAAA record contains that same address. Treat reverse names as hints, not proof of identity, since whoever controls the reverse zone can put any name there.
Classless reverse delegation
IPv4 labels are whole bytes, so reverse zones naturally split at /8, /16 and /24. To delegate a smaller block, such as the /26 from 198.51.100.64 to 198.51.100.127 given to a customer, RFC 2317 uses CNAMEs. The parent zone (here 100.51.198.in-addr.arpa, run by the "ISP") has a CNAME for each address in the block, pointing into a zone named after the block, 64/26.100.51.198.in-addr.arpa, which is delegated to the customer's server:
127.100.51.198.in-addr.arpa. 3600 IN CNAME 127.64/26.100.51.198.in-addr.arpa.
127.64/26.100.51.198.in-addr.arpa. 3600 IN PTR host127.example.net.
The / in the label is just a character: DNS labels may contain it, though host names may not.
MX: mail exchangers
MX records (type 15) name the hosts that accept email for a domain, with a preference number. Senders try the lowest value first and move to higher values if it fails:
example.com. 3600 IN MX 20 mail2.example.net.
example.com. 3600 IN MX 10 mail.example.com.
Mail for alice@example.com goes to mail.example.com (preference 10), and to mail2.example.net (20) only if the first fails. Equal preferences share the load. If a domain has no MX records at all, senders fall back to its A or AAAA records. A domain that never receives mail should say so with a null MX (RFC 7505): a single MX record with preference 0 and target ..
example.net. 3600 IN MX 0 .
TXT: free-form text
TXT records (type 16) hold one or more strings of up to 255 bytes each. They were meant for human-readable notes but now carry machine-readable policies:
example.com. 3600 IN TXT "v=spf1 mx -all"
That record is an SPF (Sender Policy Framework) policy (RFC 7208): only the hosts in the domain's MX records may send mail as example.com, and everything else should fail (-all). DKIM keys (for signing mail) and DMARC policies (what receivers should do when checks fail) are TXT records too (article 85), as are the verification tokens that cloud services ask you to publish to prove you control a domain. A dedicated SPF record type (99) once existed but is deprecated: use TXT.
Because TXT records hold whatever people put in them, a domain's apex often collects dozens of them, which makes responses large. Large responses push queries to TCP (article 51) and are attractive for amplification attacks.
SRV, NAPTR and URI: finding services
An SRV record (type 33, RFC 2782) tells clients which host and port provide a service. Its name has the form _service._protocol.domain:
_sip._udp.example.com. 3600 IN SRV 10 40 5060 sip2.example.com.
_sip._udp.example.com. 3600 IN SRV 10 60 5060 sip1.example.com.
The fields are priority (lower is tried first), weight (for sharing load among equal priorities: here sip1 should get 60% of clients and sip2 40%), port and target. SIP (voice and video calls), XMPP (chat), LDAP (directories), Kerberos (authentication) and Microsoft Active Directory use SRV records. Web browsers never adopted them, which is part of why the HTTPS record was created.
A URI record (type 256, RFC 7553) maps a service name directly to a URI:
_http._tcp.example.com. 3600 IN URI 10 1 "https://www.example.com/"
NAPTR records (type 35, RFC 3403) are the most elaborate: each holds an order, a preference, flags, a service, and a regular expression that rewrites the input into a URI or another name to look up. The framework is called the Dynamic Delegation Discovery System (DDDS). Its best-known use is ENUM (RFC 6116), which maps telephone numbers into DNS: the number +1 555 555 1234 becomes the name 4.3.2.1.5.5.5.5.5.5.1 under an ENUM domain, digits reversed like reverse lookups. The lab uses a private ENUM tree, and a shortened number, under e164.example.com:
4.3.2.1.5.5.5.1.e164.example.com. 3600 IN NAPTR 100 10 "u" "E2U+sip" "!^.*$!sip:alice@example.com!" .
4.3.2.1.5.5.5.1.e164.example.com. 3600 IN NAPTR 100 20 "u" "E2U+mailto" "!^.*$!mailto:alice@example.com!" .
A caller's phone looks up the number, applies the first rule (order 100, preference 10), and gets sip:alice@example.com, a SIP address to call instead of using the phone network. The second rule offers an email address. Public ENUM under e164.arpa saw limited use; private ENUM trees between telephone carriers are common. S-NAPTR (RFC 3958) and U-NAPTR (RFC 4848) are simplified variants used by some protocols to discover servers.
CAA: which certificate authorities may issue
A CAA record (type 257, RFC 8659) lists the certificate authorities allowed to issue TLS certificates for a domain. Every public CA must check it before issuing:
example.com. 3600 IN CAA 0 issue "ca.example.net"
Only the CA identified as ca.example.net may issue certificates for example.com and its subdomains. Other tags are issuewild (wildcard certificates only) and iodef (where to report violating requests). CAA doesn't stop an attacker who controls the DNS, but it prevents mistakes and attacks at other CAs (article 80). Since 15 March 2026, CAs must also validate DNSSEC on their CAA and domain-validation lookups whenever the zone is signed (CA/Browser Forum ballot SC-085), so a signed zone's CAA records can't be forged on their way to the CA.
SVCB and HTTPS: service bindings
The newest widely used records are SVCB (type 64) and its HTTP-specific form HTTPS (type 65), defined in RFC 9460 (2023). An HTTPS record tells a client, before it connects, how to reach a web service: which protocols it supports, which addresses to use, and the keys for encrypting the TLS handshake.

example.com. 3600 IN HTTPS 1 . alpn="h3,h2" ipv4hint=198.51.100.10 ipv6hint=2001:db8:2::10
- Priority 0 means AliasMode: the record points to another name, like a CNAME, but it's allowed at the zone apex. Priority 1 or more means ServiceMode: the record describes an endpoint, and several records can be ranked.
- Target
.means "this same name". Otherwise it names the host serving the content, which is how a CDN can be used at the apex. - alpn lists application protocols, the names used by TLS's ALPN (Application-Layer Protocol Negotiation).
h3tells the browser the server speaks HTTP/3, so it can use QUIC (article 86) on the very first connection instead of learning about it from anAlt-Svcheader later. - ipv4hint and ipv6hint let the client start connecting before its A and AAAA lookups return.
- ech carries the server's Encrypted Client Hello configuration (RFC 9849, with RFC 9848 defining its use in SVCB), so the browser can hide the site name in the TLS handshake (article 83).
An HTTPS record also tells browsers to use only HTTPS for that name, similar to HSTS (HTTP Strict Transport Security, a header that tells browsers to always use HTTPS for a site). Major browsers query HTTPS records alongside A and AAAA, and large CDNs publish them. SVCB records serve other protocols, for example to advertise encrypted DNS servers (article 55).
Unknown record types
Software that doesn't know a record type can still carry it. RFC 3597 defines a generic text form, TYPEnnn and \# length hex, that every modern server accepts. Here is the same HTTPS record in that form:
example.com. 3600 CLASS1 TYPE65 \# 41 0001000001000602683302683200040004C633640A0006001020010D B8000200000000000000000010
\# 41 says 41 bytes of data follow. 0001 is priority 1 and the next 00 is the target .. The rest are parameters, each a 2-byte key, a 2-byte length and a value: key 1 (alpn) with 02 6833 02 6832, the strings h3 and h2; key 4 (ipv4hint) with C633640A, which is 198.51.100.10; and key 6 (ipv6hint) with the 16 bytes of 2001:db8:2::10.
That's how new types like HTTPS could be deployed before every DNS server and tool understood them.
ANY queries and RFC 8482
A query of type ANY (255) asks for all records at a name. It was never a reliable way to get "everything", since a resolver returns only what it has cached, and it became a favorite of amplification attacks because the response can be huge. RFC 8482 (2019) lets servers return a small subset instead, for example a single RRset or a synthetic HINFO (host information) record. In the lab, ns2 answers ANY in full, while ns1 is configured with BIND's minimal-any:
-- ns2 (full ANY):
ANSWER: 11, AUTHORITY: 0, ADDITIONAL: 1
-- ns1 (RFC 8482 minimal ANY):
ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
example.com. 3600 IN SOA ns1.example.com. hostmaster.example.com. 2026112101 7200 900 1209600 300
-- ns1 over TCP:
ANSWER: 11, AUTHORITY: 0, ADDITIONAL: 1
Over UDP, ns1 returned one RRset. Over TCP, where spoofed sources aren't a risk, it returned all 11 records. Don't build software that depends on ANY: query the specific types you need.
Common questions
Can I put a CNAME at the root of my domain?
No. The zone apex must have SOA and NS records, and a name with a CNAME can't have any other records. Use your DNS provider's ALIAS or flattening feature, or an HTTPS record in AliasMode, which browsers support for the apex.
What's the difference between a CNAME and an HTTPS record in AliasMode?
A CNAME redirects all record types for a name and can't coexist with other records. An HTTPS record with priority 0 only says where to find the HTTPS service, so it can sit at the apex next to SOA, NS and MX records. Clients that don't understand HTTPS records ignore it, so you still need A and AAAA records for them.
Why does my mail server check the PTR record of connecting hosts?
Legitimate mail servers almost always have matching forward and reverse DNS, and many spam sources don't. It's a cheap filter, not real authentication. SPF, DKIM and DMARC (article 85) do the actual job of checking who may send for a domain.
How many TXT records can a name have?
There's no fixed limit, but each string is at most 255 bytes, and the whole response must fit in a DNS message, at most 65,535 bytes over TCP. In practice, large TXT RRsets make responses fall back to TCP and should be kept small, for example by removing old verification tokens.
What does the SOA serial have to do with my changes?
Secondaries copy the zone only when the serial increases. If you edit a zone file on the primary but forget to increase the serial, the secondaries keep serving the old data, and users get different answers depending on which server they ask.
Does every IP address have a PTR record?
No. Reverse zones are optional, many addresses have no PTR, and cloud providers often generate generic ones. Applications should never require a PTR record to work, except where policy demands it, as in some mail setups.
What is the HTTPS record for, if A and AAAA records already exist?
It gives the browser information it would otherwise learn only after connecting: that HTTP/3 is available, which alternative endpoint to use, and the ECH key that hides the site name. It saves round trips and enables privacy features. The address records remain the fallback.
Summary
- A and AAAA hold IPv4 and IPv6 addresses. NS names a zone's servers, which need glue when they're inside the zone.
- The SOA holds the primary server, administrator mailbox, serial, refresh, retry, expire and negative-caching TTL. The serial must increase with each change.
- CNAME aliases a name for all types, may not coexist with other data, and so can't be used at the apex. DNAME redirects a whole subtree.
- Wildcards (
*) match names that don't exist, not empty non-terminals or names with other data. - PTR records under
in-addr.arpa(reversed bytes) andip6.arpa(reversed hex digits) map addresses to names. RFC 2317 CNAMEs delegate IPv4 reverse zones smaller than /24. - MX lists mail servers by preference, and a null MX (
0 .) says a domain takes no mail. TXT holds strings such as SPF policies. - SRV gives a service's host, port, priority and weight. NAPTR and URI support rewriting rules and ENUM. CAA limits which CAs may issue certificates.
- SVCB and HTTPS (RFC 9460) describe how to connect: alias or service mode, ALPN including HTTP/3, address hints and ECH keys.
- Unknown types can be carried in the RFC 3597 generic form. ANY queries may get a minimal answer (RFC 8482).
Practice questions
1. Write the reverse lookup name for 192.0.2.10, and for 2001:db8::1.
Answer
10.2.0.192.in-addr.arpa. For IPv6, expand to 2001:0db8:0000:0000:0000:0000:0000:0001 and reverse the 32 digits: 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.
2. A zone has www IN CNAME web.example.net. and www IN TXT "verification=123". What's wrong?
Answer
A name with a CNAME may not have any other records. BIND refuses to load such a zone, and other servers behave unpredictably. Put the TXT record on a different name, or replace the CNAME with A and AAAA records.
3. A domain has MX records 10 mx1.example.com., 10 mx2.example.com. and 50 backup.example.net.. How does a sending server use them?
Answer
It tries the preference-10 servers first, choosing between mx1 and mx2 randomly to share the load. Only if neither accepts the message does it try backup.example.net at preference 50.
4. You edited a zone on the primary, but some users still see old data an hour later, even though the TTL is 5 minutes. The primary shows the new data. What did you probably forget?
Answer
To increase the SOA serial. The secondaries saw the same serial, decided they were up to date, and kept serving the old zone. Users whose resolvers asked a secondary got stale data.
5. An SRV RRset has 10 70 443 a.example.com., 10 30 443 b.example.com. and 20 0 443 c.example.com.. Which server gets traffic normally, and in what share?
Answer
Only the priority-10 servers are used normally: a gets about 70% of clients and b about 30%, by weight. c, at priority 20, is used only if both priority-10 servers are unreachable.
6. Why do browsers benefit from an HTTPS record with alpn="h3"?
Answer
Without it, a browser connects with TCP and TLS first, and learns from the server's Alt-Svc header that HTTP/3 is available, so it uses QUIC only on later connections. With the HTTPS record, it knows before connecting and can start with QUIC immediately, saving round trips on the first visit.
7. A wildcard *.example.com A 198.51.100.80 exists, and so does mail.example.com MX 10 mx.example.net. What does a query for mail.example.com A return?
Answer
NOERROR with no answer (NODATA). mail.example.com exists, because it has an MX record, so the wildcard doesn't apply to it, and it has no A record of its own.
Previous: Inside a DNS Message: Header, Sections, EDNS(0) and UDP Versus TCP
Next: Changing DNS: Dynamic Updates, Zone Transfers and NOTIFY

More in TCP/IP Course
Quiz: TCP/IP Delicate Details
Twenty-five questions on the details that catch out experienced engineers: sequence numbers for SYN and FIN, TIME_WAIT versus tcp_fin_timeout, Karn's algorithm, socket buffer doubling, even and odd ephemeral ports, IPv6 checksums and fragmentation, negative DNS caching, and capture filter traps.
Quiz: TCP/IP Interview Questions
Thirty-three networking questions of the kind asked in developer, SRE and network engineering interviews: what happens when you load a URL, TCP versus UDP, handshakes, closing and TIME_WAIT, subnetting, NAT, DNS, MTU problems, congestion, TLS and QUIC, and debugging slow or failing connections.
Quiz: TCP/IP Course Final Exam (All Parts)
The final exam for the TCP/IP course: thirty questions across all fourteen parts, from packets and addressing through Ethernet, ARP, IP, DHCP, NAT, ICMP, UDP, DNS, TCP connections, reliability, congestion control, security, QUIC and troubleshooting.
Quiz: Modern Transports and Troubleshooting (TCP/IP Part 14)
Review modern transports and troubleshooting: QUIC packets, handshakes, 0-RTT, streams and connection migration, HTTP/3, Multipath TCP, SCTP multihoming, and a layered method for diagnosing real network faults.
Discussion
Sign in to ask a question or share what you learned.