Print the BIND9 default configuration

Postfix has the command postconf which prints the entire Postfix configuration including its default values (default can also be shown using the -d option).

Samba has a similar command which prints the entire configuration file including its default values: testparm -v.

I'm however unable to find a similar command to print the entire configuration BIND file including its default values. I know I can look up the default values in the BIND9 Configuration Reference (Chapter 6 of the ARM) but this is tedious and the default are not easily spotted when skimming through the web page. Does this option exist for BIND?


Solution 1:

No, there is no tool/option that really does what you want.

named-checkconf -p prints the full user configuration but does not show the full effective configuration (including defaults).

You can find the default configuration for options in bin/named/config.c in the BIND codebase, BUT some configuration parameters are interdependent, where overriding one affects others as well (see eg allow-query and allow-recursion), so the effective configuration is not as simple as just overlaying the user configuration on top of the default config without additional logic.

I agree that it would sometimes be useful to have a tool that would print the full effective configuration as named would use it, but there just isn't any option for that currently.

The best readily available suggestion I can offer is searching for default in your browser before you start reading through the options in the manual to get every instance of this word highlighted, making it easier to spot the default values as you go along.

Solution 2:

The BIND configuration is little more complex than just a list of option/value pairs that can have default values which are then altered. Configuration can also be split to several files through includes.

The similar syntax checking tool and the command you are looking for is named-checkconf:

named-checkconf checks the syntax, but not the semantics, of a named configuration file. The file is parsed and checked for syntax errors, along with all files included by it. If no file is specified, /etc/named.conf is read by default.

Note: files that named reads in separate parser contexts, such as rndc.key and bind.keys, are not automatically read by named-checkconf. Configuration errors in these files may cause named to fail to run, even if named-checkconf was successful. named-checkconf can be run on these files explicitly, however.

While named-checkconf reads through named.conf and the all the configuration files included, another tool, named-checkzone checks the syntax and integrity of a zone file.