The DNS zone file makes up the technical basis for storing the DNS information of a zone. It is a text file that is stored in the file system of a server. The structure of a DNS zone file is also defined in the previously mentioned document RFC 1035. By definition, a zone file has a line-based structure, with one “directive” or “resource record” per line.
Directives begin with a dollar sign “$” and instruct the server to perform an action or apply a setting to the zone. For example, the “$INCLUDE” directive can be used to include additional, child zone files. This is useful to modularize entries of the zone file. Normally all directives are listed at the beginning of the zone file.
After the directives follow the actual DNS entries (resource records) for the described zone. To do this, a precise SOA record must exist for each DNS zone. This must be the first entry in the zone file and defines the structure of the zone and the exchange of zone data between nameservers. The SOA entry is followed by other resource records. The most important resource records include “A” records for defining server IP addresses, “MX” records for defining mail servers, and “NS” records that contain authoritative name servers for the zone.
Based on a specific name server, a zone file may exist as a writable original. In this case, the hosting server is a primary DNS server. If the zone file exists as a non-writable copy obtained from an external source, it is referred to as a secondary DNS server. A zone file can authoritatively describe a DNS zone or contain contents of a DNS cache. Let’s take a closer look at the definition as written in the document RFC 1035: