A DNS Zone is a portion of the DNS namespace that is managed by an organization or administrator. It serves as an administrative space with granular control of DNS components and records, such as authoritative nameservers. A DNS zone can contain multiple domain and subdomains. Multiple zones can also exist on the same server. Information stored for a DNS zone lives within a text file called a DNS zone file.
DNS Zone Files
A DNS Zone file is a plain text file stored on a controlling DNS server that contains all the records for every domain within a given zone. Zone files can include many different record types, but must always begin with what is called an SOA record (Start of Authority).
Types of Records
As mentioned, there are a handful of different types of records used within a DNS Zone, all of which serve a unique purpose. Below are some examples of the most commonly used record types and a brief description of each.
Start of Authority (SOA)
The first record in any zone file is the SOA resource record. This record is an essential part of the DNS zone file. It indicates the domain’s zone and the fundamental properties of the domain name server. It is the mandatory record that must be there in all zone files. It specifies the main properties and characteristics of a domain. Each zone file can contain only one SOA record.
Name Server (NS)
These records specify the DNS server responsible for this domain. These records tell recursive name servers which name servers are authoritative for a zone. Recursive name servers look at the authoritative NS records to facilitate which server to ask next when resolving a name.
Mail Exchange (MX)
MX records, usually two, are responsible for specifying which mail server is in charge of receiving email messages on behalf of a site. The email client tries to make an SMTP connection to the primary mail server listed in the zone file. The records are ranked by priority from lowest to highest with the lowest being the primary. If the primary server is not available, the next listed mail server will attempt a routing connection. MX records must point to a domain, not an IP.
Address (A)
The A record or address record is used to find the IP associated with a domain name. This record routes info from the server to the end client’s web browser. It is used to add IP address for a hostname in a zone. It is the highly used resource record in a zone file. Also when you dig for a domain, the default answer you get is a A record which is denoted by a capital A.
AAAA
The quadruple A record has the same function as the A record but is used specifically for the IPv6 protocol.
Canonical Name (CNAME)
This record will alias one site name to another. The DNS lookup will then route domain name requests the new name that the A record holds. These records must point to a fully qualified domain name.
NAME RR VALUE
--------------------------------------------------
xyz.yourdomain.com CNAME abc.yourdomain.com
abc.yourdomain.com A 172.16.142.34
In the above shown example CNAME entry, if you want to reach "xyz.yourdomain.com", your computer's DNS resolver will first fire an address lookup for "xyz.yourdomain.com", and on finding the CNAME record of "abc.yourdomainc.com", your resolver will again fire an address lookup for "abc.yourdomain.com".
Alias Record (ALIAS)
The ALIAS record is functionally similar to a CNAME record in that it is used to point one name to another. An ALIAS record is used to lead the apex domain name (example.com) to a subdomain such as host.example.com. The authoritative nameservers for the Apex domain will subsequently resolve the IP of the hostname to direct traffic.
Text (TXT)
TXT records hold the free-form text of any type. Initially, these were for human-readable information about the server such as location or data center. Presently, the most common uses for TXT records today are SPF and Domain_Keys(DKIM).
Service Locator (SRV)
Generalized service location record, used for newer protocols instead of creating protocol-specific records such as MX. This type of record, while helpful, is not commonly used.
Pointer (PTR)
Pointer records point an IP to a canonical name and used explicitly in reverse DNS. It is important to note that a reverse DNS record needs to be set up on the authoritative nameservers for the person that owns the IP, not the person that owns the canonical name.