named-checkzone
The named-checkzone
command is a utility in the BIND (Berkeley Internet Name Domain) suite used to check the syntax and integrity of DNS zone files. It validates the zone file, ensuring that it complies with DNS standards and is free from errors.
Basic Syntax
The basic syntax for named-checkzone
is:
zone-name: The name of the DNS zone.
zone-file: The path to the zone file to be checked.
Common Options
-i style
: Sets the integrity checking level. The options arefull
,none
, andwarn
. The default isfull
.-k mode
: Sets the "check-names" mode. Options arewarn
,fail
, andignore
. The default is the value specified in named.conf orfail
if not specified.-j
: Treat the zone file as a journal file.-J
: Output the zone file in journal format.-n mode
: Sets the "check-names" mode for the owner names of records. Options arewarn
,fail
, andignore
.-q
: Quiet mode. Only errors are printed.-v
: Prints the version ofnamed-checkzone
and exits.-D
: Dumps the zone file in canonical format.-o file
: Outputs the parsed zone file to the specified file.-k mode
: Sets the "check-names" mode for owner names of records. Options arewarn
,fail
, andignore
.-M
or-m
: Check if the zone file should have MX records.
Example Usage
Basic Zone File Check
To check a zone file example.com.zone
for the zone example.com
, use the following command:
Checking a Zone File with Specific Options
To check a zone file and set specific integrity checking and "check-names" modes:
Quiet Mode
To check a zone file and only print errors:
Output to a File
To check a zone file and output the parsed zone file to another file:
Practical Scenario
Suppose you have a DNS zone file for example.com
located at /etc/bind/zones/example.com.zone
, and you want to validate it:
If the zone file is valid, you will see output similar to:
If there are errors, they will be printed to the console, helping you identify and fix them.
Benefits of Using named-checkzone
named-checkzone
Error Detection: Helps identify and fix syntax errors and misconfigurations in zone files before they are loaded by the DNS server.
Standards Compliance: Ensures that the zone file complies with DNS standards and best practices.
Time-Saving: Saves time by catching errors early in the configuration process, reducing troubleshooting and downtime.
Validation: Provides a way to validate changes to zone files before deploying them, ensuring that updates are correct and will not cause issues.
Conclusion
The named-checkzone
tool is an essential utility for DNS administrators using BIND. It helps ensure the integrity and correctness of DNS zone files by performing thorough syntax and compliance checks. By understanding and utilizing its various options, administrators can effectively manage and validate their DNS zones, ensuring smooth and error-free DNS operations.
Last updated