Types of resources records in zone files
A zone file stores the DNS data of a specific domain. In a zone file, a resource record defines the characteristics and properties of an entity available within the domain. There are many types of resource records. The most important types are SOA, NS, MX, A or AAAA, and CNAME.
The SOA (Start of Authority) record
It defines the domain's global characteristics and authorizes a name server for it. It is a compulsory record. Each zone file must include one SOA record. You cannot add more than one SOA record to a zone file. You can add only one SOA record in a zone file.
It uses the following syntax.
domain-name TTL class-type record-type name-server e-mail-address serial-number refresh-time retry-time expiry-time negative-cache-TTL
The following is an example SOA record. It authorizes ns1.example.com. name server for the domain.
; The SOA (Start of Authority) record
@ IN SOA ns1.example.com. hostmaster.example.com. (
2023013100 ; serial-number
12 h; refresh-time
15 m; retry-time
3 w; expiry-time
2 h; negative-cache-TTL
)
If you use a single @ character in the domain name field, it replaces it with the domain name stored in the $ORIGIN directive.
The NS (Name Server) record
It defines the authorized DNS servers for this domain. It is a compulsory record. There must be at least two name server records in a zone file. You can also add a reference to an external name server.
It uses the following syntax.
domain-name TTL class-type record-type authorized-name-server
The following are examples of the NS record.
; The NS records.
; Primary or main NS server. Available within the domain.
3w IN NS ns1.example.com.
; Secondary or backup NS server. Available outside the domain.
IN NS ns2.example.net.
The above NS records define two name servers. The ns1.example.com. is the primary name server available within the domain. The ns2.example.net. is the secondary or backup name server. It is available outside the domain.
The MX (Mail Exchanger) record
It defines the mail servers for this domain. It is an optional record. If the domain does not provide email services, you do not need to add it to the zone file. You can also add a reference to an external email server.
It uses the following syntax.
domain-name TTL class-type record-type preference email-server-name
The following are examples of the MX record.
; The MX records
; Primary or main NS server. Available within the domain.
3w IN MX 10 mail.example.com.
; Secondary or backup NS server. Available outside the domain.
IN MX 20 mail.example.net.
In the above example, MX records configure two mail servers. The mail.example.com mail server is internal and is available within the domain. The mail.example.net mail server is external. It is available outside the domain.
The A (Address) record
It defines the IPv4 address of a host or service within this domain that must be publicly visible. It is an optional record. It uses the following syntax.
name TTL class-type record-type IPv4 address
The following are example A records.
; The A records ns1 IN A 172.168.1.1 mail IN A 172.168.1.2 www IN A 172.168.1.3
The AAAA (Quad A) record
It defines the IPv6 address of a host or service within this domain that must be publicly visible. It is an optional record. It uses the following syntax.
name TTL class-type record-type IPv4 address
The following are examples of AAAA records.
ns1 IN AAAA 2002:db7:: mail IN AAAA 2002:db8:: www IN AAAA 2002:db9::
The CNAME record
It defines an alias name for a host or service within the domain and must be publicly visible under that alias.
It uses the following syntax.
alias-name TTL class-type record-type host-or-service-name
The following are example CNAME records.
; The CNAME records ftp IN CNAME fhost www IN CNAME whost
This tutorial is part of the following tutorial series on DNS server concepts and configurations.
Chapter 01 How to configure DNS Server in Linux
Chapter 02 DNS Basic Concepts, Fundamentals, and Terminology
Chapter 03 DNS Server and Query Types Explained
Chapter 04 The /etc/hosts, /etc/resolv.conf, and /etc/nsswitch.conf files
Chapter 05 The dig command on Linux
Chapter 06 The nslookup command on Linux
Chapter 07 Change or specify the DNS server to the nslookup command
Chapter 08 DNS zone File Format
Chapter 09 The TTL and ORIGIN directives in the zone file
Chapter 10 Types of resources records in zone files
Chapter 11 The SOA Record Explained in the DNS zone file
Chapter 12 The NS Record, Glue record, and Lame Delegation
Chapter 13 The MX record in a zone file explained
Chapter 14 The a, aaaa, and cname DNS record types
Chapter 15 The pointer (PTR) record and Reverse mapping Explained
Chapter 16 How to configure a caching-only name server
Chapter 17 How to configure DNS Forwarding and a forwarder name server
Chapter 18 How to configure a primary or master authoritative name server
Chapter 19 How to configure a secondary or slave authoritative name server
Chapter 20 How to configure reverse mapping on DNS name servers
Conclusion
Zone files are essential components of DNS management. They contain various resource records (such as SOA, NS, MX, A, AAAA, and CNAME). They define the key characteristics and services associated with a domain. Each record type serves a unique purpose. Understanding how to structure and configure these records lets you manage domain operation more efficiently.
Author Laxmi Goswami Updated on 2026-08-23