what's wrong with my Ubuntu 11.10 bind9 configuration?

John Bowlinger asked:

I’ve followed several tutorials on installing your own nameservers and I’m pretty much at my wit’s end, because I cannot get them to resolve. Note, the actual domain and ip address has been changed for privacy to example.com and 192.168.0.1. My named.conf.local file:

zone "example.com" {
    type master;
    file "/var/cache/bind/example.com.db";
};

zone "0.168.192.in_addr.arpa" {
  type master;
  file "/var/cache/bind/192.168.0.db";
};

My named.conf.options file:

options {
    forwarders {
       192.168.0.1;
     };

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

My resolv.conf file:

search example.com.
nameserver 192.168.0.1

My Forward DNS file:

ORIGIN example.com.
$TTL  86400
@    IN    SOA   ns1.example.com.    root.example.com. (
    2012083101  ; Serial
    604800  ; Refresh
    86400  ; Retry
    2419200  ; Expire
    3600 )  ; Negative Cache TTL

example.com. NS    ns1.example.com.
example.com. NS    ns2.example.com.
example.com. MX    10 mail.example.com.

@        IN  A  192.168.0.1
ns1.example.com       IN  A  192.168.0.1
ns2.example.com       IN  A  192.168.0.2
mail     IN  A  192.168.0.1
server1  IN  A  192.168.0.1

gateway    IN CNAME ns1.example.com.
headoffice IN CNAME server1.example.com.
smtp       IN CNAME mail.example.com.
pop        IN CNAME mail.example.com.
imap       IN CNAME mail.example.com.
www        IN CNAME server1.example.com.
sql        IN CNAME server1.example.com.

And my reverse DNS:

$ORIGIN 0.168.192.in-addr.arpa.
$TTL  86400
@  IN  SOA  ns1.example.com.  root.example.com. (
    2009013101  ; Serial
    604800  ; Refresh
    86400  ; Retry
    2419200  ; Expire
    3600 )  ; Negative Cache TTL

1    PTR mail.example.com.
1    PTR server1.example.com.
2    PTR ns1.example.com.

Yet, when I restart bind9 and do:

host ns1.example.com localhost

I get:

Using domain server:
Name: localhost
Address: 127.0.0.1#53
Aliases: 

Host ns1.example.com.example.com not found: 2(SERVFAIL)

Similarly, for:

host 192.168.0.1 localhost

I get:

;; connection timed out; no servers could be reached

Anybody know what’s going on? Btw, my domain name “www.example.com” that I’ve used in this question is being forwarded to my ISP’s nameservers. Would that affect my bind9 configuration? I want to learn how to do set up nameservers on my own for learning, so that is why I’m going through all this trouble.

My answer:


The problematic entries are here:

ns1.example.com       IN  A  192.168.0.1
ns2.example.com       IN  A  192.168.0.2

Your domain gets added to the end of each of these, if you haven’t terminated them with a period. To get it working, change them to:

ns1       IN  A  192.168.0.1
ns2       IN  A  192.168.0.2

You also need to make the change @Zoredache gave to fix your reverse DNS (but you wouldn’t have discovered that problem until later…)


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.