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

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

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

My resolv.conf file:

search example.com.

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
ns1.example.com       IN  A
ns2.example.com       IN  A
mail     IN  A
server1  IN  A

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

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

Similarly, for:

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

share|improve this question

4 Answers 4

up vote 3 down vote accepted

both those answers are good.. bind ships with a tool you can use to check zones/conf files

named-checkzone domain.com /path/to/domain.com.zone

There is also


to check for your configs.

share|improve this answer
Good suggestion. named-checkconf just returns with nothing. When I do named-checkzone I get "near '': bad dotted quad", "near '': bad dotted quad". Then when I remove the periods I get "NS 'ns1.example.com' has no address records (A or AAAA)", "NS 'ns2.example.com' has no address records (A or AAAA)". I can't win! –  John Bowlinger Sep 7 '12 at 23:10
you don't add the .'s after the ip. Its after a full hostname you do so that tells bind not to append the ORIGIN on to the end. Look at the example @Michael Hampton did.. that is how you should be doing it for ns1/ns2 –  Mike Sep 7 '12 at 23:20
Thanks! Works like a charm now. On my Reverse dns, I check it by doing "named-checkzone example.com var/cache/bind/192.168.0.db", no? I keep getting "ignoring out-of-zone data (0.168.192.in-addr.arpa)", "ignoring out-of-zone data (", "ignoring out-of-zone data (". –  John Bowlinger Sep 8 '12 at 0:58
That isn't a reverse domain.. it would be something like named-checkzone 0.168.192.in-addr.arpa var/cache/bind/192.168.0.db –  Mike Sep 8 '12 at 2:57
I get the error "zone 0.168.192.in-addr.arpa/IN: has no NS records", "zone 0.168.192.in-addr.arpa/IN: not loaded due to errors.". So I had the brilliant idea to include " IN A ns1.example.com.", " IN A ns2.example.com." in the forward dns file (example.com.db). But I guess it wasn't so brilliant because it's still not working:( –  John Bowlinger Sep 8 '12 at 3:51

Replace the _ with a - as in in-addr.

zone "0.168.192.in_addr.arpa" {

Should be

zone "0.168.192.in-addr.arpa" {
share|improve this answer
Thanks. I corrected that. Still not working though... –  John Bowlinger Sep 7 '12 at 22:47
When you start/restart bind tail a look and see if any errors show up in the syslog. Update your question with any errors/warnings you see. –  Zoredache Sep 7 '12 at 22:52
When I run named-checkzone I get bad dotted quad errors. Then when I remove said dotted quads that were suggested to me by Michael Hampton, I get has no address records errors. Confused. –  John Bowlinger Sep 7 '12 at 23:13

The problematic entries are here:

ns1.example.com       IN  A
ns2.example.com       IN  A

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
ns2       IN  A

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

share|improve this answer
Thank you. That was definitely an oversight on my part. I fixed it. but it's still not working. –  John Bowlinger Sep 7 '12 at 22:49

First things first.. After launching named, make sure that it is still running and has not exited with errors of some sort. Does named show up in ps output? What is it logging to syslog? Have you configured rndc? If so, what does "rndc status" say? When you get SERVFAIL and "connection timed out" messages (as above) you need to ensure that you are talking to a live server.

Does it log anywhere else besides syslog? (you only show us an included subset of your named.conf, so I am not sure whether the main named.conf has logging stanzas declared sending log information elsewhere.)

Check ps to make sure named is running, and check syslog to see if it is complaining about anything when it tries to start.

Aside from that, what are you meaning to accomplish with the line in your configuration that declares forwarders?

When you get ready to test, test using fully qualified domain names (FQDNs), e.g.:

dig ns1.example.com. @localhost

to avoid confusing situations like you had above:

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

(you can see that because of the search rule in your resolv.conf file, "example.com" was appended to a domain name which already contained it.. you can eliminate the ambiguity by using FQDNs.)

share|improve this answer

Your Answer


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.