Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 and My named.conf.local file:

zone "" {
    type master;
    file "/var/cache/bind/";

zone "" {
  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:


My Forward DNS file:

$TTL  86400
@    IN    SOA (
    2012083101  ; Serial
    604800  ; Refresh
    86400  ; Retry
    2419200  ; Expire
    3600 )  ; Negative Cache TTL NS NS MX    10

@        IN  A       IN  A       IN  A
mail     IN  A
server1  IN  A

gateway    IN CNAME
headoffice IN CNAME
smtp       IN CNAME
pop        IN CNAME
imap       IN CNAME
www        IN CNAME
sql        IN CNAME

And my reverse DNS:

$TTL  86400
@  IN  SOA (
    2009013101  ; Serial
    604800  ; Refresh
    86400  ; Retry
    2419200  ; Expire
    3600 )  ; Negative Cache TTL

1    PTR
1    PTR
2    PTR

Yet, when I restart bind9 and do:

host localhost

I get:

Using domain server:
Name: localhost

Host 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 "" 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
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 /path/to/

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 '' has no address records (A or AAAA)", "NS '' 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 var/cache/bind/192.168.0.db", no? I keep getting "ignoring out-of-zone data (", "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 var/cache/bind/192.168.0.db – Mike Sep 8 '12 at 2:57
I get the error "zone has no NS records", "zone not loaded due to errors.". So I had the brilliant idea to include " IN A", " IN A" in the forward dns file ( 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 "" {

Should be

zone "" {
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:       IN  A       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 @localhost

to avoid confusing situations like you had above:

Host not found: 2(SERVFAIL)

(you can see that because of the search rule in your resolv.conf file, "" 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.