named-checkconf utility comes bundled with the BIND package and is used to check the syntax of an named configuration file. The named-checkconf will traverse your entire bind configuration and any included files. When managing many thousand domains this is useful: Any configuration syntax error introduced will usually cause the nameserver to stop processing at that error. In other words, any zones specified after the error will not get loaded into the nameserver:
# ./named-checkconf ./named.conf;echo $? 0
And now we’ve left out a “.” in an IP address within an allow-transfer statement:
# ./named-checkconf ./named.conf;echo $? ./named.conf:724: undefined ACL '72167.238.111' 1
In case you encounter an error as shown below:
named-checkconf: command not found
You may need to install the bind9utils package as per your choice of distribution.
Distribution | Command |
---|---|
OS X | brew install bind |
Debian | apt-get install bind9utils |
Ubuntu | apt-get install bind9utils |
Alpine | apk add bind |
Arch Linux | pacman -S bind |
Kali Linux | apt-get install bind9utils |
Fedora | dnf install bind |
Raspbian | apt-get install bind9utils |
Docker | docker run cmd.cat/named-checkconf named-checkconf |
Summary
named-checkconf utility is used to check the syntax named configuration files. The output should return nothing for a good/correct file. In case of a badly formatted configuration file you should see some error.
To check all configuration files at once:
# named-checkconf -z