Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have trouble setting up a new domain and can't figure out what I'm missing. This is a domain in a closed network so there will be exactly one DNS server and I'm testing this on the very server.

I have the following settings done (I'm using bind9):

/etc/bind/named.conf:

include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.local";
include "/etc/bind/named.conf.default-zones";

/etc/bind/named.conf.options:

options {
        directory "/var/cache/bind";

        auth-nxdomain no;    # conform to RFC1035
        listen-on-v6 { any; };
};

(What is that directory, btw?)

/etc/bind/named.conf.local:

zone "mydomain.com" {
        type master;
        file "mydomain.com.db";
};

zone "160.16.172.in-addr.arpa" {
        type master;
        file "rev.160.16.172.in-addr.arpa";
};

/etc/bind/mydomain.com.db:

$TTL 3D
@ IN SOA ns.mydomain.com. admin.mydomain.com. (
   201007121
   28800
   3600
   604800
   38400
);
@       IN      NS      ns1
ns1     IN      A       172.16.160.67
sonic.mydomain.com IN      A       172.16.160.67
                TXT     "Network Gateway"

named-checkzone says everything is OK.

Reverse DNS also seems to work:

root@sonic:/etc/bind# dig -x 172.16.160.67

; <<>> DiG 9.7.0-P1 <<>> -x 172.16.160.67
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 38189
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;67.160.16.172.in-addr.arpa.    IN      PTR

;; ANSWER SECTION:
67.160.16.172.in-addr.arpa. 259200 IN   PTR     redmine.mydomain.com.
67.160.16.172.in-addr.arpa. 259200 IN   PTR     gw.mydomain.com.

;; AUTHORITY SECTION:
160.16.172.in-addr.arpa. 259200 IN      NS      ns.mydomain.com.

;; Query time: 0 msec
;; SERVER: 172.16.160.67#53(172.16.160.67)
;; WHEN: Tue Jul 13 08:46:35 2010
;; MSG SIZE  rcvd: 108

(I have a few extra domains in the reverse DNS file that I have removed from the zone file while trying to solve this.)

But the domain can't be found:

root@sonic:/etc/bind# dig mydomain.com

; <<>> DiG 9.7.0-P1 <<>> mydomain.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 45088
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;mydomain.com.                      IN      A

;; Query time: 0 msec
;; SERVER: 172.16.160.67#53(172.16.160.67)
;; WHEN: Tue Jul 13 08:49:27 2010
;; MSG SIZE  rcvd: 26

I have defined the /etc/resolv.conf to only include the address of that server as the nameserver.

I'm guessing I'm missing something that is not implicitely told in the documents explaining how to setup a DNS server.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Save the zone files into /var/named instead of /etc/bind, restart BIND and try dig again.

share|improve this answer
    
This didn't seem to help. –  Marko Poutiainen Jul 13 '10 at 6:53
    
Store the zone file in /var/cache/bind as said in directory directive. The filename directive should be relative path to that directory. –  mkudlacek Jul 13 '10 at 10:41
    
Ah, I see. I'll accept your answer, because you were right, even if a bit vague for a newbie binder like me. –  Marko Poutiainen Jul 14 '10 at 5:56

I figured out the problem in the end. For some reason bind didn't find the zone definition file if I didn't put an absolute path to named.conf.local. I don't know what the default path is supposed to be, but looks like it isn't /etc/bind or /var/named.

share|improve this answer
1  
You can use the "directory" parameter in your options file to tell BIND which directory to use as the root for its various config files. In your case you would simply add 'directory "/etc";'. This makes things easier to maintain that hard-coding paths, especially when the system grows. BTW, BIND is generally run chrooted. –  John Gardeniers Jul 13 '10 at 12:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.