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):


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


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

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

(What is that directory, btw?)


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";


@ IN SOA ns.mydomain.com. admin.mydomain.com. (
@       IN      NS      ns1
ns1     IN      A
sonic.mydomain.com IN      A
                TXT     "Network Gateway"

named-checkzone says everything is OK.

Reverse DNS also seems to work:

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

; <<>> DiG 9.7.0-P1 <<>> -x
;; 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

;    IN      PTR

;; ANSWER SECTION: 259200 IN   PTR     redmine.mydomain.com. 259200 IN   PTR     gw.mydomain.com.

160.16.172.in-addr.arpa. 259200 IN      NS      ns.mydomain.com.

;; Query time: 0 msec
;; 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

;mydomain.com.                      IN      A

;; Query time: 0 msec
;; 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.


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

  • 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.

  • 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

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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