I l@ve RuBoard Previous Section Next Section

10.3 Finding a Syntax Error in a Zone Data File

10.3.1 Problem

You need to find a syntax error in a zone data file.

10.3.2 Solution

Find the log messages from the most recent restart or reload of the name server, reloading again if necessary, as described in Section 10.2. Then look for a message indicating the line of the zone data file that contains the error. For example:

Jun 25 16:15:13 ns1 named[53941]: starting BIND 9.2.1
Jun 25 16:15:13 ns1 named[53941]: using 1 CPU
Jun 25 16:15:13 ns1 named[53941]: loading configuration from '/etc/named.conf'
Jun 25 16:15:13 ns1 named[53941]: listening on IPv4 interface fxp0, 192.168.0.1#53
Jun 25 16:15:13 ns1 named[53941]: listening on IPv4 interface lo0, 127.0.0.1#53
Jun 25 16:15:13 ns1 named[53941]: command channel listening on 0.0.0.0#953
Jun 25 16:15:13 ns1 named[53941]: dns_rdata_fromtext: db.foo.example:7: near eol: 
unexpected end of input
Jun 25 16:15:13 ns1 named[53941]: zone foo.example/IN: loading master file db.foo.
example: unexpected end of input
Jun 25 16:15:13 ns1 named[53941]: running

And, of course, you can start your BIND 9 name server with -g to force it to run in the foreground and print errors to stderr.

If you'd rather not start a new named process, you can use the BIND 9 named-checkzone program, as described in Recipe Section 5.3. Like named-checkconf, named-checkzone is built with the same routines that named uses. To run it, specify the domain name of the zone and the name of the zone data file as arguments:

# named-checkzone foo.example db.foo.example
dns_rdata_fromtext: db.foo.example:7: near eol: unexpected end of input
zone foo.example/IN: loading master file db.foo.example: unexpected end of input

10.3.3 Discussion

Since the master file format didn't change between BIND 8 and BIND 9, you can also use named-checkzone on zone data files you load on your BIND 8 name server. The only difference you might encounter is that BIND 8 name servers can be configured to allow multiple CNAME records attached to the same domain name, while BIND 9 name servers can't.

10.3.4 See Also

Section 5.3, for using named-checkzone to check a zone data file.

    I l@ve RuBoard Previous Section Next Section