LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-19-2011, 12:53 PM   #1
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
bind9 config files: leading whitespace requirements?


Hello

Is leading whitespace significant in bind9 config files?

This reverse lookup file (/var/chroot/bind9/etc/bind/zones/rev.168.168.192.in-addr.arpa) did not work; /var/log/messages had "zone 168.168.192.in-addr.arpa/IN: has no NS records".

Inserting 3 spaces before IN in the NS line fixed it:
Code:
; IP Address-to-Host DNS Pointers for the 192.168.168.0 subnet
@ IN SOA CW8vDS.localdomain. hostmaster.localdomain. (
    2011041901 ; serial
    8H ; refresh
    4H ; retry
    4W ; expire
    1D ; minimum
)
; Define the authoritative name server
   IN NS CW8vDS.localdomain.  <== leading spaces on this line
; Other hosts, in numeric order
1  IN PTR router.localdomain.
[snip]
Reading the man pages and netsearching, I did not find anything about indentation requirements except for "This is usually indented for readability, but the indents are required syntactically" here.

Although the above file works, named-checkconf reports an error in it:
Code:
root@CW8vDS:/var/chroot/bind9/etc/bind/zones# named-checkconf rev.168.168.192.in-addr.arpa 
rev.168.168.192.in-addr.arpa:1: syntax error near ';'
but named initialisation does not log any errors or warnings in /var/log/messages when processing this file except "/etc/bind/zones/rev.168.168.192.in-addr.arpa:2: no TTL specified; using SOA MINTTL instead".

Best

Charles

Last edited by catkin; 04-19-2011 at 12:54 PM. Reason: clarification
 
Old 04-19-2011, 01:37 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Cool

It's not so much leading white space as it is that there is a "field" before the IN that could be populated if your zone file had a different recordsfor the NS files. If you look at your other zones and "IN A" records it would be obvious there is a field before the "IN".

e.g.
Standard NS for the current zone:
IN NS CW8vDS.localdomain
-OR-
service.dns.localdomain. IN NS CW8vDS.localdomain
 
1 members found this post helpful.
Old 04-20-2011, 08:46 AM   #3
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578

Original Poster
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Thanks MensaWater that explains it. For transparency I have changed the line to
Code:
<defective change removed>
EDIT:
Code:
@ IN NS CW8vDS.localdomain.

Last edited by catkin; 04-20-2011 at 09:17 AM.
 
Old 04-21-2011, 03:06 AM   #4
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578

Original Poster
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by catkin View Post
Although the above file works, named-checkconf reports an error in it:
Code:
root@CW8vDS:/var/chroot/bind9/etc/bind/zones# named-checkconf rev.168.168.192.in-addr.arpa 
rev.168.168.192.in-addr.arpa:1: syntax error near ';'
If I now understand correctly the above error message is because named-checkconf cannot be used for checking zone files such as rev.168.168.192.in-addr.arpa in which the ";" comment introducer is allowed.
 
Old 04-21-2011, 03:22 AM   #5
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,174
Blog Entries: 1

Rep: Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040
Hi,

You're right. named-checkconf is used to check named.conf where ";" is used in the statements.
Btw, regarding the leading whitespace, quoting from here:
Quote:
@
; replace with the current value of $ORIGIN

; blank/space or tab in which case the last name used or the value of $ORIGIN (or its default value) is substituted
Regards
 
1 members found this post helpful.
Old 04-21-2011, 03:48 AM   #6
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578

Original Poster
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Thanks bathory

I finally found an explanation of leading whitespace in O'Reilly's "DNS and BIND 5th Edition" in section 4.4.3. "Repeat Last Name":

If a resource record name (that starts in the first column) is a space or tab, then the name from the last resource record is used. You use this if there are multiple resource records for a name. Here's an example in which there are two address records for one name:
Code:
wormhole      IN A        192.249.249.1
              IN A        192.253.253.1
In the second address record, the name wormhole is implied. You can use this shortcut even if the resource records are of different types.


In the case of the first resource record, leading whitespace is equivalent to @.

EDIT: @ is shorthand for $ORIGIN

EDIT 2: great link; bookmarked. It even has a section on file naming conventions (although I have chosen to follow the Debian and O'Reilly convention instead).

Last edited by catkin; 04-21-2011 at 03:53 AM.
 
Old 04-21-2011, 01:09 PM   #7
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Quote:
Originally Posted by catkin View Post
If I now understand correctly the above error message is because named-checkconf cannot be used for checking zone files such as rev.168.168.192.in-addr.arpa in which the ";" comment introducer is allowed.

named-checkconf is used for checking the named configuration file (typically named.conf). You can use named-checkzone for checking your zone files.
 
Old 04-22-2011, 04:35 AM   #8
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578

Original Poster
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by MensaWater View Post
named-checkconf is used for checking the named configuration file (typically named.conf). You can use named-checkzone for checking your zone files.
Thanks MensaWater

It looks as if named-checkzone can be used to check zone files but not to check a reverse lookup zone file:
Code:
root@CW8vDS:/var/chroot/bind9/etc/bind# named-checkzone localdomain db.localdomain 
zone localdomain/IN: loaded serial 2011042101
OK
root@CW8vDS:/var/chroot/bind9/etc/bind# named-checkzone localdomain db.192.168.168
db.192.168.168:16: ignoring out-of-zone data (168.168.192.in-addr.arpa)
db.192.168.168:25: ignoring out-of-zone data (168.168.192.in-addr.arpa)
zone localdomain/IN: has 0 SOA records
zone localdomain/IN: has no NS records
zone localdomain/IN: not loaded due to errors.
root@CW8vDS:/var/chroot/bind9/etc/bind# cat db.192.168.168
; Address-to-name pointers for the 192.168.168.0 subnet

; WHEN CHANGING THIS FILE change the serial string!

; The format of this file is explained in O'Reilly's "DNS and BIND" 5th Edition
; in section 4.2. The definitive reference is available from http://www.bind9.net/manuals 
; but does not cover comments and blank lines (either in the 9.7.x pdf file or 
; the online 9.3.2 HTML).
; Leading space implies an empty (defaulted) "owner name"; for clarity this is 
; not used.

; Set the time-to-live of cached data from this zone
$TTL 30m

168.168.192.in-addr.arpa. IN SOA CW8vDS.localdomain. hostmaster.localdomain. (
    2011042101 ; serial, format YYYYMMDDII where II is an index
    8H ; refresh
    4H ; retry
    4W ; expire
    1D ; minimum
)

; Set CW8vDS as the localdomain Internet name server
168.168.192.in-addr.arpa. IN NS CW8vDS.localdomain.

; Other hosts in numeric order
1 IN PTR router.localdomain.
[snip similar]
51 IN PTR CW8vDS.localdomain.
AFAIK the only way to check a reverse lookup zone file is to use named-checkconf with the -z option on the master configuration file:
Code:
root@CW8vDS:~# named-checkconf -z /var/chroot/bind9/etc/bind/named.conf
zone localdomain/IN: loaded serial 2011042101
zone 168.168.192.in-addr.arpa/IN: loaded serial 2011042101
zone localhost/IN: loaded serial 2
zone 127.in-addr.arpa/IN: loaded serial 1
zone 0.in-addr.arpa/IN: loaded serial 1
zone 255.in-addr.arpa/IN: loaded serial 1

Last edited by catkin; 04-22-2011 at 04:37 AM. Reason: too many reds!
 
Old 04-22-2011, 07:27 AM   #9
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,174
Blog Entries: 1

Rep: Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040
Hi catkin,

named-checkzone syntax is:
Quote:
named-checkzone
usage: named-checkzone [-djqvD] [-c class] [-f inputformat] [-F outputformat] [-t directory] [-w directory] [-k (ignore|warn|fail)] [-n (ignore|warn|fail)] [-m (ignore|warn|fail)] [-r (ignore|warn|fail)] [-i (full|full-sibling|local|local-sibling|none)] [-M (ignore|warn|fail)] [-S (ignore|warn|fail)] [-W (ignore|warn)] [-o filename] zonename filename
So to check the reverse zone you should run:
Code:
named-checkzone 168.168.192.in-addr.arpa /var/chroot/bind9/etc/bind/zones/rev.168.168.192.in-addr.arpa
Note also that named-checkconf -z is used to check all the zone files present in named.conf

Regards
 
2 members found this post helpful.
Old 04-22-2011, 07:39 AM   #10
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578

Original Poster
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Thanks bathory

"168.168.192.in-addr.arpa" was the zone name to use for the reverse lookup zone file

There had to be a way!

Last edited by catkin; 04-22-2011 at 07:41 AM.
 
Old 04-22-2011, 11:56 AM   #11
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Quote:
Originally Posted by bathory View Post
Hi catkin,

named-checkzone syntax is:

So to check the reverse zone you should run:
Code:
named-checkzone 168.168.192.in-addr.arpa /var/chroot/bind9/etc/bind/zones/rev.168.168.192.in-addr.arpa
Note also that named-checkconf -z is used to check all the zone files present in named.conf

Regards
Nice to know that. By the way if your setup is chrooted (as mine is) you can can specify "-t <chrootdir>" along with the -z to make it work. (It didn't work without that.) e.g. if your chroot is the standard RHEL5 one /var/named/chroot (so that etc and var/named are subdirectories of /var/named/chroot) you'd run:
named-checkconf -z -t /var/named/chroot /etc/named.conf
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
bind9 config issue koszta5 Linux - Software 1 01-26-2011 05:32 PM
remove multiple files with whitespace coldy78 Linux - General 1 12-10-2007 02:23 AM
bind9 zones config files help lucastic Linux - Server 1 09-25-2007 04:24 PM
No config files after installation of bind9 hondo Linux - Server 7 09-02-2007 05:07 AM
need help with bind9 config ssfrstlstnm Linux - Networking 4 04-13-2007 06:41 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration