Back to tools

How to generate a DNS zone file

1

Define the domain name

Enter the main domain name (e.g., example.com) and the server IP address for the A record.

2

Configure additional records

Add CNAME records for subdomains (www, mail, blog), MX records for email, and TXT records for verification and SPF.

3

Set the TTL

Define the TTL (Time To Live) in seconds. Common values: 300 (5 min) for development, 3600 (1 hour) for production, 86400 (24h) for stable records.

4

Generate and download

Generate the zone file in BIND format. Download the file or copy the content to install on your DNS server.

5

Install on the DNS server

Copy the file to /etc/bind/zones/, configure named.conf.local and reload BIND9 with sudo systemctl reload bind9.

BIND9 Configuration

After generating your DNS zone, configure it in BIND9:

1. Create zones directory

sudo mkdir -p /etc/bind/zones

2. Copy zone file

sudo cp db.example.com /etc/bind/zones/db.example.com

3. Configure named.conf.local

zone "example.com" {
    type master;
    file "/etc/bind/zones/db.example.com";
};

4. Verify and reload

sudo named-checkzone example.com /etc/bind/zones/db.example.com
sudo systemctl reload bind9

DNS Record Types Explained

Each DNS record type serves a specific function in name resolution. Here are the most important ones:

  • A Record: Points a domain name to an IPv4 address. The most basic and essential record for any website.
  • AAAA Record: Similar to A but for IPv6 addresses. Required if your server supports IPv6.
  • CNAME Record: Creates an alias from one name to another. E.g., www.example.com → example.com. Cannot coexist with other records on the same name.
  • MX Record: Defines mail servers for the domain with priority. Lower number = higher priority.
  • TXT Record: Stores arbitrary text. Used for domain verification (SPF, DKIM, DMARC, Google Workspace, etc.).
  • NS Record: Specifies authoritative DNS servers for the domain.
  • SRV Record: Defines specific services (SIP, LDAP, XMPP) with port and priority.

Our generator automatically creates the SOA record with recommended values and supports all these record types. Simply select the ones you need and the tool will generate the complete BIND9 zone file.

Frequently Asked Questions

What is a DNS zone file?

A DNS zone file is a text file that defines DNS records for a domain (A, AAAA, CNAME, MX, TXT, etc.). It uses the standard BIND format and is interpreted by DNS servers like BIND9, PowerDNS or NSD to resolve domain name queries.

Which DNS records do I need for a website?

For a basic website you need: an A record (or AAAA for IPv6) pointing to the server IP, an MX record for email, and optionally a CNAME for www. It is also recommended to include TXT records for domain verification and SPF/DKIM for email.

What is the difference between A and CNAME records?

An A record points a domain name directly to an IP address. A CNAME record creates an alias that points to another domain name. For example, "www" can be a CNAME of "example.com", and "example.com" has an A record pointing to the server IP.

What is an SOA record and how do I configure it?

SOA (Start of Authority) is the essential record of every DNS zone. It defines: the primary DNS server (MNAME), the admin email (RNAME), the serial number (must increment on each change), the refresh interval (secondary check period), retry interval if refresh fails, expiration time and minimum TTL. Our tool generates the SOA automatically with recommended default values.

How does the serial number work in a DNS zone?

The serial is a version number that identifies the zone file revision. Secondary DNS servers compare the serial against their local copy: if the primary serial is higher, they download the updated zone. The recommended format is YYYYMMDDNN (year, month, day, revision number), e.g. 2026060501 for June 5, 2026 revision 1. You must increment this number every time you modify the zone for changes to propagate.

What are NS and SRV records used for?

NS (Name Server) records define which DNS servers are authoritative for the domain. You need at least two for redundancy. SRV (Service) records specify the location of specific services like SIP, LDAP or XMPP, with format: _service._protocol.domain TTL class SRV priority weight port target. For example, _sip._tcp.example.com points to the SIP server on port 5060.