Hi,

So I set up a local caching server with bind. It seems to work, kind of, the 
problem is that cached results do not stay in cache for long, if they placed in 
cache at all. For example, in the example below bind caches the result for 
"old.reddit.com" but 8 minutes later tries to look up "old.reddit.com" again 
when it's supposed to have the result in cache.

Any ideas? Thanks


# aptitude show bind9
Package: bind9                          
...
Version: 1:9.8.4.dfsg.P1-6+nmu2+deb7u20


# cat lless named.conf.options
...

options {
    directory "/var/cache/bind";

    listen-on port 53 { our-nets; };   
    allow-query { our-nets; };
    allow-query-cache { our-nets; };
  
    recursion yes;
    allow-recursion { our-nets; };

    auth-nxdomain no;    # conform to RFC1035
    blackhole { bogusnets; };
};


# rndc dumpdb --cache

# cat /var/cache/bind/named_dump.db
; Dump complete


# cat db.127
;
; BIND reverse data file for local loopback interface
;
$TTL    604800
@       IN      SOA     localhost. root.localhost. (
            2018091900 ; Serial
            28800      ; Refresh
            7200       ; Retry
            604800     ; Expire
            86400      ; Negative Cache TTL
);
@       IN      NS      localhost.
1.0.0   IN      PTR     localhost.



# dig old.reddit.com

; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> old.reddit.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 45712
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 4, ADDITIONAL: 4

;; QUESTION SECTION:
;old.reddit.com.                        IN      A

;; ANSWER SECTION:
old.reddit.com.         241     IN      CNAME   reddit.map.fastly.net.
reddit.map.fastly.net.  8       IN      A       151.101.21.140

;; AUTHORITY SECTION:
fastly.net.             862     IN      NS      ns4.fastly.net.
fastly.net.             862     IN      NS      ns1.fastly.net.
fastly.net.             862     IN      NS      ns2.fastly.net.
fastly.net.             862     IN      NS      ns3.fastly.net.

;; ADDITIONAL SECTION:
ns1.fastly.net.         83935   IN      A       23.235.32.32
ns2.fastly.net.         83935   IN      A       104.156.80.32
ns3.fastly.net.         83935   IN      A       23.235.36.32
ns4.fastly.net.         83935   IN      A       104.156.84.32

;; Query time: 3 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Sun Sep 16 17:41:59 2018
;; MSG SIZE  rcvd: 219


# dig old.reddit.com

; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> old.reddit.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 28790
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 4, ADDITIONAL: 4

;; QUESTION SECTION:
;old.reddit.com.                        IN      A

;; ANSWER SECTION:
old.reddit.com.         234     IN      CNAME   reddit.map.fastly.net.
reddit.map.fastly.net.  1       IN      A       151.101.21.140

;; AUTHORITY SECTION:
fastly.net.             855     IN      NS      ns4.fastly.net.
fastly.net.             855     IN      NS      ns3.fastly.net.
fastly.net.             855     IN      NS      ns1.fastly.net.
fastly.net.             855     IN      NS      ns2.fastly.net.

;; ADDITIONAL SECTION:
ns1.fastly.net.         83928   IN      A       23.235.32.32
ns2.fastly.net.         83928   IN      A       104.156.80.32
ns3.fastly.net.         83928   IN      A       23.235.36.32
ns4.fastly.net.         83928   IN      A       104.156.84.32

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Sun Sep 16 17:42:06 2018
;; MSG SIZE  rcvd: 219



# dig old.reddit.com

; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> old.reddit.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 5572
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;old.reddit.com.                        IN      A

;; Query time: 2537 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Sun Sep 16 17:50:08 2018
;; MSG SIZE  rcvd: 32

Reply via email to