DNS zone file
DNS zone file, also known as the master file (RFC 1035), is a simple text file that defines a particular DNS zone by including all DNS resource records (RR) for that zone. This DNS zone file is located on the primary name server. Any changes to the domain name are performed at the primary DNS zone that is located in the primary name server. They are modifications to the DNS zone files. Adding or removing DNS RR will change the content of the zone file.
DNS zone file format
When you open a DNS zone file, you will see a sequence of different entries. Each one is a different DNS record like SOA, NS, A, AAAA, CNAME, MX, PTR, TXT, etc.
In a single DNS zone file, all the RR should be from the same class, and there must be only one SOA.
The DNS records use one of the two formats:
[<TTL>] [<class>] <type> <RDATA>
[<class>] [<TTL>] <type> <RDATA>
@ IN SOA AMAZONA Action\.domains ( 20 ; SERIAL 7200 ; REFRESH 500 ; RETRY 3600000; EXPIRE 60) ; MINIMUM @ 3600 IN NS AMAZONA. @ 3600 IN NS COLORADO. @ 3600 IN MX 10 AMAZONA. @ 3600 IN MX 20 COLORADO. A 3600 IN A 188.8.131.52 AMAZONA 3600 IN A 184.108.40.206 AMAZONA 3600 IN A 220.127.116.11 COLORADO 3600 IN A 18.104.22.168 COLORADO 3600 IN A 22.214.171.124
In this example, you can see a very simple zone file. It has an SOA record that indicates the start of authority. You can see that this domain name has 2 name servers – AMAZONA and COLORADO because there are two NS records. Below it, you have 2 MX records that show the email servers that should receive emails on behalf of the domain name. And there are a few name records showing the IP address of the servers.
How to edit the DNS zone file?
On-premise DNS server. You need to have administrative privileges on that server. You can add or remove DNS records in a different way, depending on the OS.
On a Windows server
For example, it is Windows Server, Go to the Server Manager, then Dashboard. From there, find Tools, which is located on the right corner, and press the DNS from its menu.
It will open the DNS Manager. Inside it, you can see the DNS zones – Forward Lookup Zones and Reverse Lookup Zones. Next, open the folder of the Zone, where you want to add or remove records. Inside it, you can either create a new record, edit an existing one or delete it. If you don’t have the folders of the zones already created, you can add new Zones.
On a Linux server
In this case, we are using the RedHat distro, and we will use the command ipa dnsrecord-add. It works on different distributions too.
You need to be an administrator or to have sudo privileges. Open the command line and add records with the following command:
ipa dnsrecord-add zoneName recordName –recordType-option=data
zoneName – put the name of the zone in which you want to add a record.
RecordName – the name of the record you want to create.
-recordType – The type of record you would like to add.
On a Managed DNS
There it is the easiest. Most providers have an intuitive web-based interface where you can easily find how to add or remove DNS zones and how to add, modify or remove DNS records. Everything happens with a few clicks.
DNS zone file is the one that holds all the information about a particular DNS zone. You manage the zone by adding and removing DNS records inside it.