DNS Troubleshooting – Why DNS Won’t Work Despite Following Tutorial

binddomain-name-systemlinuxtroubleshootingunix

If anyone can help me troubleshoot this, I would very much appreciate it!!

The tests work. It's just that when I do the manual ping/nslookup test, nothing is working.
By the way, I followed everything in this tutorial.

This is my /etc/bind/zones/master/main.com.db file:

;
; BIND data file for main.com
;
$TTL    604800
@       IN      SOA     main.com. info.main.com. (
                            2007011501         ; Serial
                                  7200         ; Refresh
                                   120         ; Retry
                               2419200         ; Expire
                                604800)        ; Default TTL
;
@       IN      NS      ns1.main.com.
@       IN      NS      ns2.main.com.
main.com.    IN      MX      10      mail.main.com.
main.com.    IN      A       174.143.182.58
www                     IN      CNAME   main.com.
mail                    IN      A       174.143.182.58
ftp                     IN      CNAME   main.com.
main.com.            IN      TXT     "v=spf1 ip4:174.143.182.58 a mx ~all"
mail                    IN      TXT     "v=spf1 a -all"

This is my reverse DNS (/etc/bind/zones/master/174.143.182.rev) file:

$TTL 1d ;
$ORIGIN 182.143.174.IN-ADDR.ARPA.
@       IN      SOA     ns1.main.com.   info.main.com. (
                                       2007011501
                                       7200
                                       120
                                       2419200
                                       604800
)
        IN      NS      ns1.main.com.
        IN      NS      ns2.main.com.
1       IN      PTR     ns1.main.com.
2       IN      PTR     ns2.main.com.

This is my named.conf.local file for BIND:

zone "main.com" {
       type master;
       file "/etc/bind/zones/master/main.com.db";
};

zone "182.143.174.IN-ADDR.ARPA" {
       type master;
       file "/etc/bind/zones/master/174.143.182.58.rev";
};

When I do my named-checkzones, it works.

named-checkzone main.com main.com.db
zone main.com/IN: NS 'ns1.main.com' has no address records (A or AAAA)
zone main.com/IN: NS 'ns2.main.com' has no address records (A or AAAA)
zone main.com/IN: loaded serial 2007011501
OK

However, something is wrong when I restart BIND9.

/etc/init.d/bind9 restart
Stopping domain name service...: bind9rndc: connect failed: 127.0.0.1#953: connection refused
.
Starting domain name service...: bind9.

When I do a ping test, it does not work:

ping ns1.main.com
PING ns1.main.com (72.16.146.146) 56(84) bytes of data.
64 bytes from ns1.main.com (72.16.146.146): icmp_seq=1 ttl=52 time=20.0 ms

I expect the ping test to show my IP (174.143.182.58) instead of 72.16.146.146.

I even tried to edit my resolve.conf to the same IP:

nameserver      174.143.182.58

If anyone can help figure out why it's not detecting my own IP when I ping it…please help me!

Best Answer

You haven't got A records for your nameservers ns1.main.com and ns2.main.com. The named-checkzones hasn't worked as it is warning you that you haven't got A records for your nameservers:

zone main.com/IN: NS 'ns1.main.com' has no address records (A or AAAA)

zone main.com/IN: NS 'ns2.main.com' has no address records (A or AAAA)

So you need to add the following to your main.com.db file:

ns1           IN    A    174.143.182.1
ns2           IN    A    174.143.182.2

Without these glue records the whole thing won't work.

Also your SOA record for main.com is wrong. It should be:

@       IN      SOA     ns1.main.com. info.main.com.

It didn't fail in the named-checkzones because you have a main.com A record and BIND assumed that was the name server record.