Some DNS background.
The DNS is a system of managing domains and IP addresses. It has a specific tree-like structure built with hierarchy. For administrative purposes and to make the whole system more manageable and decentralized, it uses delegated partitions called DNS zone. The DNS zone is a part of the Domain namespace that has its autonomy of management.
What is a DNS zone file?
Each of the delegated partitions called DNS zones has a DNS zone file where the DNS administrator for each zone can add instruction, settings, authentication mechanisms, and more for the zone. They are in the form of DNS records – simple text instructions that other computers and sometimes people can read and understand.
DNS zone file format explained in detail
So, the DNS administrator of a zone controls it by adding and removing DNS records, and all that data is saved in a DNS zone file.
DNS records could be:
- DNS A record – a domain to its IPv4 address link.
- DNS AAAA record – a domain to IPv6 address link.
- DNS SOA record – showing information about the start of authority and zone transfering. It is a must-have on every zone file. It also includes information about the administrator of the zone.
- DNS MX record – a domain to its incoming mail server link.
- DNS TXT record – a specific DNS record that could be used for many different verification and authentication mechanisms.
- DNS SRV record – indicating services that the host uses and their parameters.
- And more…
Who can you edit it?
Only the administrator of a particular zone can edit the particular zone file. It does it by adding new DNS records, modifying existing records, or deleting them.
Where can you find the DNS zone file?
Each DNS zone needs to be hosted on a DNS server. If it is a Primary DNS zone file, it will be hosted on a Primary Authoritative DNS server. In case it is a Secondary DNS zone, it will have a copy of the zone file from the Primary DNS zone, and it will be hosted on a Secondary DNS server.
How can you get information about a DNS zone?
You can perform a DNS query and get different DNS records of a domain name with typical DNS probing tools like Nslookup, Dig command, Host command, and more. You will have access to only publicly available DNS records. There could be other DNS records that are for inside use only.
If you want to get a complete copy of the zone file, you can perform a zone transfer. Usually, the DNS administrators limit who can perform zone transfer, but you can use one of the above mention DNS commands and perform zone transfer if there is no limit set. You can get the whole zone file and later save it in a text document for further use.
How to copy the DNS zone file of a Primary DNS zone to a Secondary DNS zone?
You can perform a complete zone transfer (AXFR) and get the zone file from the Primary DNS server to the Secondary DNS server.
In case you want to copy only the newest changes from the Primary DNS server to the Secondary DNS server, you need to perform an incomplete zone transfer (IXFR).
To summarize:
The DNS zone file is a single file that contains all the DNS records for a DNS zone. All the instructions, indications, and settings that the DNS administrator of the zone has added.