Jump to content

Finding a syntax error in a zone data file

+ 1
  cricketliu's Photo
Posted Sep 15 2009 11:56 AM

Find the log messages from the most recent restart or reload of the name server, reloading again if necessary. 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. 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
Cover of DNS & Bind Cookbook
Learn more about this topic from DNS & Bind Cookbook. 

The DNS & BIND Cookbook presents solutions to the many problems faced by network administrators responsible for a name server. This title is an indispensable companion to DNS & BIND, 4th Edition, the definitive guide to the critical task of name server administration. The cookbook contains dozens of code recipes showing solutions to everyday problems, ranging from simple questions, like, "How do I get BIND?" to more advanced topics like providing name service for IPv6 addresses.

Learn More Read Now on Safari


Tags:
0 Subscribe


0 Replies