Zone File
A zone file is a plain text file stored on a name server that contains information about the domains within that name server's zone. It includes contact information about that name server's administrator and lists each domain and subdomain alongside its corresponding IP address. Zone files are a critical part of the Domain Name System infrastructure, allowing computers to locate servers on the Internet at all levels of the DNS system hierarchy.
The DNS system delegates portions of the larger namespace into zones, which may be subdivided into smaller zones. The largest zones cover the entirety of each top-level domain (like .com and .net). Within those are smaller zones managed by other nameservers, which may consist of a single domain (example.com) and its subdomains (mail.example.com) or cover a larger group of multiple domains. Each name server maintains a zone file for the domains within its zone and the corresponding IP address for each domain and subdomain. When another computer on the Internet makes a request to that name server, it checks the zone file and returns the requested domain's IP address.
Zone files store several important pieces of information about a domain. Each zone file begins with one or more directives — lines of text that start with a '$' character and set instructions for the name server to follow, like specifying a TTL expiration timer or an origin domain for relative domain names to follow. Every zone file needs to include a Start of Authority (SOA) record that lists the email address of the name server's administrator, an address for an authoritative master DNS server, and settings for how and when to refresh the zone file's contents. The bulk of a zone file consists of DNS records for domain names and subdomains, matching a specific domain name with the corresponding server's IP address.