≡ Menu

How do I check Bind zone file for errors?

Question – I added a few zones to my Bind zone files. I need to check them for errors. How do I do that?

There is a Bind utility called named-checkzone which can be used to check Bind named zone files.

The syntax for using this tool is as follows:

named-checkzone domainname zonefilename

For example, I want to check the zone file for ewhathow.com:

root@server [/etc]# named-checkzone ewhathow.com /var/named/ewhathow.com.db
zone ewhathow.com/IN: loaded serial 2013082103

So the zone file is free from errors!

Now if there is an error in the zone file, it will output messages saying that there is a syntax error:

root@server [/etc]# named-checkzone ewhathow.com /var/named/ewhathow.com.db
dns_master_load: /var/named/ewhathow.com.db:2: unexpected end of line
dns_master_load: /var/named/ewhathow.com.db:1: unexpected end of input
zone ewhathow.com/IN: loading from master file /var/named/ewhathow.com.db failed: unexpected end of input
zone ewhathow.com/IN: not loaded due to errors.

If you get an error like the above, please open the zone file in an editor and fix the syntax errors.

Comments on this entry are closed.