DNS zones contain the authoritative mapping between domain names and IP addresses for your infrastructure. Losing zone data means your domains become unreachable — email bounces, websites go offline, and API endpoints fail. While DNS zone transfers (AXFR/IXFR) provide replication between servers, they do not constitute a backup strategy. This guide covers DNS zone backup and recovery approaches for three authoritative DNS servers: BIND 9, PowerDNS Authoritative, and NSD.
We will explore native backup mechanisms, automated export tools, disaster recovery procedures, and Docker Compose deployments for each platform.
BIND 9: Native Zone File Backup
BIND 9 stores zone data in plain-text zone files on disk. This makes backup straightforward — you can copy the files directly or use standard backup tools.
Zone File Storage
BIND 9 zone files are typically stored in /etc/bind/zones/ or /var/named/. Each zone has its own file in standard RFC 1035 format. BIND automatically updates these files when you make changes via nsupdate (dynamic DNS) if the update-policy and masterfile-format are configured correctly.
Docker Compose Deployment
| |
Manual Backup Commands
| |
Automated Backup Script
| |
PowerDNS Authoritative: Database-Backed Backup
PowerDNS Authoritative stores zone data in a database backend (MySQL, PostgreSQL, SQLite). Backing up zones means backing up the database, which provides consistent snapshots without freezing zones.
Docker Compose Deployment
| |
Database initialization script (init-pdns.sql):
| |
API-Based Zone Export
PowerDNS provides a REST API for zone export, which is useful for backup without database access:
| |
Database Backup with mysqldump
| |
NSD: Minimalist Zone Backup
NSD (Name Server Daemon) is a lightweight authoritative-only DNS server. Like BIND, it stores zones in plain-text files, making backup simple. NSD focuses on being a fast, secure, and easy-to-manage authoritative server without recursive resolution capabilities.
Docker Compose Deployment
| |
NSD configuration (nsd.conf):
| |
Zone File Backup
| |
NSD Zone Signing Backup
If you use DNSSEC with NSD, you also need to back up the signed zone files and key material:
| |
Comparison: BIND vs PowerDNS vs NSD Backup
| Feature | BIND 9 | PowerDNS Authoritative | NSD |
|---|---|---|---|
| Storage backend | Plain-text zone files | Database (MySQL, PG, SQLite) | Plain-text zone files |
| Backup method | File copy, AXFR export | Database dump, API export | File copy, AXFR export |
| Consistency during backup | Requires rndc freeze | Database transaction consistency | File copy (live) |
| Incremental backup | No (full zone files) | Database binary logs | No (full zone files) |
| Zone export format | RFC 1035 zone file | JSON via API, SQL dump | RFC 1035 zone file |
| API access | No (control via rndc) | Full REST API | No (control via nsd-control) |
| DNSSEC key backup | Manual (key files) | In database (if stored) | Manual (key files) |
| Catalog zones | Yes (RFC 7494) | Yes | No |
| Docker image | ubuntu/bind9:9.18 | powerdns/pdns-auth-49 | nlnetlabs/nsd:latest |
| GitHub / project | ISC (isc.org) | PowerDNS (pdns.nl) | NLnet Labs (nlnetlabs.nl) |
| License | MPL 2.0 | GPL 2.0 | BSD 2-Clause |
| Best for | Traditional zone file workflows | Database-backed, API-driven deployments | Minimalist authoritative-only setups |
Why Self-Host Your DNS Zone Backups?
DNS zone data is the foundation of your network infrastructure. Losing it means every domain you manage stops resolving — websites, email, APIs, and internal services all become unreachable. Self-hosted zone backups ensure:
- Immediate recovery capability — restore zones on your own servers without waiting for a managed DNS provider
- Historical versioning — keep historical zone snapshots for auditing and rollback after accidental changes
- Regulatory compliance — maintain backup copies in specific geographic locations to meet data residency requirements
- Cost control — avoid per-zone backup fees charged by managed DNS providers
- Disaster recovery independence — if your primary DNS provider experiences an outage, you can quickly deploy a backup instance
For comprehensive DNS health validation to ensure your backed-up zones are syntactically correct before deploying them, see our DNSViz vs Zonemaster guide. If you manage zone provisioning across multiple DNS providers, our DNSControl vs OctoDNS vs Lexicon comparison covers infrastructure-as-code approaches. For DNSSEC validation of your restored zones, our Unbound vs Knot Resolver vs PowerDNS DNSSEC guide covers validation strategies.
FAQ
How often should I back up DNS zones?
Back up zones after every change and at least daily for static zones. Use rndc notify (BIND) or PowerDNS API webhooks to trigger backups immediately after zone modifications. For high-churn environments (dynamic DNS), consider hourly backups or continuous database replication.
Can I restore a BIND zone backup to PowerDNS?
Yes. BIND zone files are in standard RFC 1035 format, which PowerDNS can import using pdnsutil load-zone or the PowerDNS API. The reverse (PowerDNS database to BIND) requires exporting zones via the API or a database query and formatting as zone files.
Does NSD support zone transfers as a backup method?
NSD supports outgoing AXFR (zone transfers) to secondary servers. You can configure a secondary NSD or BIND instance to pull zones via AXFR, effectively creating a live backup. However, this is replication, not a point-in-time backup — if a zone is corrupted on the primary, the corruption propagates to the secondary.
What is the difference between a zone file backup and an AXFR export?
A zone file backup copies the raw file from disk, including comments, formatting, and any non-standard directives. An AXFR export queries the running DNS server and receives only the standardized resource records. For restoration purposes, both are functionally equivalent, but zone files may contain additional metadata (SOA serial comments, TTL overrides) that AXFR does not preserve.
How do I verify a DNS zone backup before deploying it?
Use named-checkzone (BIND), nsd-checkzone (NSD), or the PowerDNS API to validate the zone syntax before deployment. Check that the SOA serial is correct, all required record types are present (A, AAAA, MX, NS), and DNSSEC signatures (if applicable) are valid. Tools like DNSViz and Zonemaster provide comprehensive validation.
Can I use rsync for BIND zone file backups?
Yes. rsync is an excellent tool for BIND zone file backups because it only transfers changed files. For large zone directories with hundreds of zones, rsync is significantly faster than full copies. Combine with --backup and --backup-dir to maintain versioned copies of changed files.
| |