A Domain Name System (DNS) zone file is a text file that describes a DNS zone. A DNS zone is a subset, often a single domain, of the hierarchical domain name structure of the DNS. The zone file contains mappings between domain names and IP addresses and other resources, organized in the form of text representations of resource records (RR). A zone file may be either a DNS master file, authoritatively describing a zone, or it may be used to list the contents of a DNS cache.
The format of a zone file is defined in RFC 1035 (section 5) and RFC 1034 (section 3.6.1). This format was originally used by the Berkeley Internet Name Domain (BIND) software package, but has been widely adopted by other DNS server software – though some of them (e.g. NSD, PowerDNS) are using the zone files only as a starting point to compile them into database format, see also Microsoft DNS with Active Directory-database integration.
A zone file is a sequence of entries for resource records. Each line is a text description that defines a single resource record (RR). The description consists of several fields separated by white space (spaces or tabs) as follows:
The name field may be left blank. If so, the record inherits the field from the previous record.
The field ttl (time-to-live) specifies the time after which a domain name client must discard the record and perform a new resolution operation to obtain fresh information. If ttl is not specified, the global TTL specified at the top of the zone file is used.
The field record class indicates the namespace of the record information. The most commonly used namespace is that of the Internet, indicated by parameter IN, but others exist and are in use, e.g., CHAOS.
The field record type is an abbreviation for the type of information stored in the last field, record data. The type also provides the name of each record. For example, an address record, having the identifier A for IPv4 and AAAA for IPv6, maps the domain name from the first field to an IP address in the record data, and a mail exchanger record (MX) specifies the (SMTP) mail host for a domain.