DNS and Zone Files
By InterServer Staff on October 23rd, 2015
In simple words, DNS – Domain Name System, translates human-readable domain names to machine-readable IP address. A DNS zone is a portion of a domain name space using the Domain Name System (DNS) for which administrative responsibility has been delegated. Every domain name has several DNS settings known as DNS records. To keep these DNS records in order, we create a DNS zone. DNS zone is also an administrative function, such as authoritative name servers. When a web browser needs to find the IP address for a hostname when DNS lookup it will take to the DNS server that manages the DNS zone for that hostname. A single DNS zone can include multiple domains and subdomains. Also, multiple DNS zones can be added on a single server.
A DNS zone file is a text file and the format is defined in RFC 1035 and RFC 1034, which contains all the records such as, IP, nameservers etc for a specific domain. Each DNS zone file should start with the two records, TTL(Time To Live), which specifies for how long the records should be kept in the DNS server’s cache and SOA (Start of Authority) record, which specifies the primary authoritative name server for the DNS zone.
We can add other records such as A record, name server records etc after specifying the TTL and SOA records. While adding records to the DNS zone file, make sure that each line holds only one record and the hostname end with a period (.). Hostnames which have no period on the end will consider as a part of the main domain name, for which DNS Zone was created. For eg: if you are creating DNS Zone file for example.com, there is no need to place a period after specifying ‘www’ records.
In a DNS zone file, each line represents a DNS resource record. Each record is made up of the fields.
Name – Alphanumeric identifier of the DNS record
TTL – Time To Live. If TTL is not specified, the global TTL of the top of the zone file is used.
Record type – specifies the DNS record type, like A record, NS record etc.
For eg : example.com. 14400 IN A XX.XX.XX.XX
Types of Record in DNS Zone file
DNS zone file has different types of records, which are used for a unique purpose. The most commonly used record types are listed below.
1) Start of Authority (SOA)
This is the first record in every DNS zone file. This is the essential part of the DNS zone file because it consists of the fundamental properties of the domain name server. Only one SOA record for each zone file.
2) Name Server (NS)
Name servers are the fundamental part of the DNS. The NS records tell recursive name servers which name servers are authoritative for a zone. In simple, NS record tells your domain’s current DNS provider.
3) Mail Exchange (MX)
MX records, specifying which mail server is receiving email messages on behalf of the domain. Usually, MX records consist of two parts: the priority and the domain name.
eg: 0 mail.example.com
From the above example, ‘0’ is the priority and ‘mail.example.com’ is the mail server to which the domain connects. The lower the number in priority filed have higher priority.
4) Address (A)
The A record specifies the IP address which is associated with the domain name. A record is used for IPv4 protocol.
This record has the function same as the A record and it is mainly used for the IPv6 protocol.
6) Canonical Name (CNAME)
The CNAME record will alias one website to another. Make sure that CNAME records must always point to another domain name, never directly to an IP address.
7) Alias Record (ALIAS)
The ALIAS record is similar in function as CNAME record, used to point one website name to another. To understand ALIAS record clearly, consider you have a domain example.com and you want point to a hostname like web.hello.com, you need to use ALIAS record instead of CNAME record.
8) Text (TXT)
TXT records are used to include human-readable information about a server and they have provided needed information to the outside sources. A fully qualified domain name may have many TXT records. The most common uses for TXT records are Sender Policy Framework (SPF), Domain Keys (DK), Domain Keys Identified E-mail (DKIM), and DMARC.
9) Pointer (PTR)
PTR record used to resolve an IP address to the domain name or hostname. PTR records are mainly used for reverse DNS lookup.
If you need any further help, please do reach our support department.