The bind package has utilities to check the syntax of named.conf and any zone files. We can make use of those binaries to check our modifications done to those files before reloading or restarting named service.
To check the sytax of zone file /var/named/kb.com.db for the domain kb.com,
[root@bash ~]# named-checkzone kb.com /var/named/kb.com.db
zone kb.com/IN: loaded serial
OK
[root@ bash~]#
If everything is correct, it will show the serial number with which the zone file is loaded. Otherwise, it will give error message indicating the line number at which the error occured.
To check the syntax of named.conf file,
[root@bash ~]# named-checkconf /etc/named.conf
[root@bash~]#
You may also load the configuration of all master zones listed in named.conf at the time of checking the syntax as,
[root@bash ~]# named-checkconf -z /etc/named.conf
zone localdomain/IN: loaded serial 42
zone localhost/IN: loaded serial 42
zone 0.0.127.in-addr.arpa/IN: loaded serial
zone 255.in-addr.arpa/IN: loaded serial 42
zone 0.in-addr.arpa/IN: loaded serial 42
zone kb.com/IN: loaded serial
[root@bash ~]#
The command will show a detailed output in case any error in named.conf file.
This way we can make sure that we are not editing the configuration file wrongly.
No comments:
Post a Comment