nsd-checkzone
Validate DNS zone files and create IXFR differencesSynopsis
Description
nsd-checkzone reads a DNS zone file and checks it for syntax errors. It prints errors to stderr and exits with nonzero status on failure. This tool is used to:- Validate zone files before loading them into nsd(8)
- Create IXFR (incremental zone transfer) data from zone file differences
- Print parsed zone contents in normalized format
Options
Print usage help information and exit.
The name of the zone to check (e.g., “example.com”).
The file to read. Use ”-” to read from stdin.
Print the zone contents to stdout if the zone is valid. This prints the contents as parsed by NSD’s formatting routines, not a literal copy of the input.The output format is similar to what
nsd-control write produces.Create an IXFR from the differences between the old zone file and the new zone file.
- The argument to
-iis the old zone file - The other zonefile argument is the new zone file
.ixfr. This is where NSD reads IXFRs when configured for the zone.Existing IXFR files are renamed to become older IXFR versions. If the output file already exists with correct contents, no new file is created.The number of IXFR versions to store, at most. This is the maximum number of
.ixfr files created for the zone.Older IXFR versions are deleted when this number is exceeded.The maximum storage in bytes to use for IXFRs.
- If an IXFR is bigger than this size, it is not created
- If the sum of IXFR storage exceeds this limit, older IXFR versions are deleted
- Default is 1048576 bytes (1 MB)
Examples
Basic Zone Validation
Check a zone file for syntax errors:Validate and Print
Check a zone and print the normalized output:Read from stdin
Validate zone data from a pipeline:Create IXFR Data
Generate IXFR differences between two zone versions:/var/zones/example.com.zone.ixfr containing the incremental changes.
Create IXFR with Custom Limits
Limit IXFR storage to 10 versions and 10 MB:IXFR File Management
When using the-i option, nsd-checkzone manages IXFR files:
File Naming
For a zonefile/var/zones/example.com.zone, IXFR files are named:
/var/zones/example.com.zone.ixfr- Latest IXFR/var/zones/example.com.zone.ixfr.1- Previous version/var/zones/example.com.zone.ixfr.2- Older version- etc.
Version Rotation
When a new IXFR is created:- Existing
.ixfris renamed to.ixfr.1 - Existing
.ixfr.1is renamed to.ixfr.2 - And so on…
- Files beyond
-nlimit are deleted - New IXFR is written to
.ixfr
Size Management
If total IXFR storage exceeds-s bytes:
- Oldest IXFR files are deleted first
- Deletion continues until under the size limit
Duplicate Detection
If the new IXFR would be identical to the existing.ixfr file:
- No new file is created
- Existing IXFR files are not rotated
- This prevents duplicate IXFR entries
Integration with NSD
Manual IXFR Creation
Use nsd-checkzone to manually create IXFRs when NSD is not running:Automated IXFR Creation
For zones withcreate-ixfr: yes in nsd.conf, NSD automatically creates IXFRs when reading zone files. However, you can still use nsd-checkzone for manual IXFR creation when NSD is not running.
Exit Code
The nsd-checkzone program exits with:- 0: Success (zone is valid)
- Non-zero: Zone has errors
Common Errors
Typical zone file errors detected:Syntax Errors
SOA Errors
Domain Name Errors
Resource Record Errors
See Also
- nsd(8) - NSD name server daemon
- nsd-checkconf(8) - Check NSD configuration
- nsd.conf(5) - NSD configuration file format