DNS server (BIND) stops forwarding. Restart helps. Why?

0

3

I'm encountering very strange issue with my DNS server, which is set up to forward requests for a specific domain to another DNS server. After restarting named I'm able to resolve hostnames, but after some time forwarding stops working. Another restart helps. I've tried versions 9.8.2 and 9.10 - it works the same.

named.conf:

options {
        #listen-on port 53 { 127.0.0.1; };
        #listen-on-v6 port 53 { ::1; };
        directory       "/var/named";
        dump-file       "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
        allow-query       { any; };
        allow-query-cache { any; };
        allow-transfer    { any; };
        allow-recursion   { any; };
        recursion yes;

        dnssec-enable no;
        dnssec-validation no;
        dnssec-lookaside auto;

        /* Path to ISC DLV key */
        bindkeys-file "/etc/named.iscdlv.key";

        managed-keys-directory "/var/named/dynamic";
};

zone "video54.local" IN {
        type forward;
        forwarders { 172.21.2.1; };
};

zone "idc.local" IN {
        type master;
        file "dynamic/idc.local.db";
        allow-update { key "idc.local."; };
};

dig, when DNS stops resolving:

dig @127.0.0.1 idc-git.video54.local

; <<>> DiG 9.10.0-RedHat-9.10.0-0.el6 <<>> @127.0.0.1 idc-git.video54.local
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 21317
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;idc-git.video54.local.     IN  A

;; AUTHORITY SECTION:
.           10374   IN  SOA a.root-servers.net. nstld.verisign-grs.com. 2014072100 1800 900 604800 86400

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Jul 21 12:44:38 IDT 2014
;; MSG SIZE  rcvd: 125

dig again, after restart:

dig @127.0.0.1 idc-git.video54.local

; <<>> DiG 9.10.0-RedHat-9.10.0-0.el6 <<>> @127.0.0.1 idc-git.video54.local
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 55990
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;idc-git.video54.local.     IN  A

;; ANSWER SECTION:
idc-git.video54.local.  3600    IN  A   172.21.3.33

;; Query time: 2 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Jul 21 12:44:56 IDT 2014
;; MSG SIZE  rcvd: 66

Can you please tell me what's wrong?

Thanks!

Michael Spector

Posted 2014-07-21T09:46:42.737

Reputation: 173

Answers

2

When it "fails", you can see you get an SOA record from a real root server so that means your name server went out the usual path and tried to find the answer out on the Internet.

The reason for that is your forwarder (172.21.2.1) didn't respond quick enough so it fell back to finding the answer the normal way.

To stop this, you need to add forward only to your zone statement to stop this behavior. The default behavior is forward first.

I.e.,

zone "video54.local" IN {
    type forward;
    forwarders { 172.21.2.1; };
    forward only;
};

milli

Posted 2014-07-21T09:46:42.737

Reputation: 1 682