$linuxjunkies
>

named-checkconf(1)

Check the syntax and validity of a BIND named configuration file.

UbuntuDebianFedoraArch

Synopsis

named-checkconf [-h] [-v] [-j] [-t directory] [configfile]

Description

named-checkconf checks the syntax of a named configuration file without starting the BIND DNS server. It verifies that the configuration is valid before applying it in production, helping catch errors that would otherwise cause named to fail on startup.

If no configfile is specified, named-checkconf defaults to /etc/bind/named.conf or the system default location. The command performs comprehensive validation including zone file references, ACL definitions, and option consistency.

Common options

FlagWhat it does
-hPrint a short help message and exit
-vPrint version information and exit
-jRead the configuration file and print it in JSON format (for programmatic parsing)
-t directorySet the root directory used for relative file paths in the config (like chroot)
-xRead the configuration file and print it in expanded XML format
-zCheck zone files for syntax errors in addition to named.conf

Examples

Check the default named configuration file for syntax errors

named-checkconf

Explicitly check the specified configuration file

named-checkconf /etc/bind/named.conf

Validate named.conf syntax and also check all referenced zone files

named-checkconf -z /etc/bind/named.conf

Check configuration using /var/cache/bind as the root directory for relative paths

named-checkconf -t /var/cache/bind /etc/bind/named.conf

Check config and output as JSON, then extract the directory option with jq

named-checkconf -j /etc/bind/named.conf | jq .options.directory

Check config and print a message only if syntax is valid (exit code 0)

named-checkconf /etc/bind/named.conf && echo 'Config OK'

Related commands