Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #200207 > unrolled thread

Bind: A caching local server caches but not for long

Started bylocal10 <local10@tutanota.com>
First post2018-09-17 00:30 +0200
Last post2018-09-17 13:30 +0200
Articles 4 — 3 participants

Back to article view | Back to linux.debian.user


Contents

  Bind: A caching local server caches but not for long local10 <local10@tutanota.com> - 2018-09-17 00:30 +0200
    Re: Bind: A caching local server caches but not for long Pascal Hambourg <pascal@plouf.fr.eu.org> - 2018-09-17 00:50 +0200
      [SOLVED] Re: Bind: A caching local server caches but not for long local10 <local10@tutanota.com> - 2018-09-20 22:20 +0200
    Re: Bind: A caching local server caches but not for long Michael Stone <mstone@debian.org> - 2018-09-17 13:30 +0200

#200207 — Bind: A caching local server caches but not for long

Fromlocal10 <local10@tutanota.com>
Date2018-09-17 00:30 +0200
SubjectBind: A caching local server caches but not for long
Message-ID<wyNId-6wn-1@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#200208

FromPascal Hambourg <pascal@plouf.fr.eu.org>
Date2018-09-17 00:50 +0200
Message-ID<wyO1z-6Cq-3@gated-at.bofh.it>
In reply to#200207
Le 17/09/2018 à 00:20, local10 a écrit :
> 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.

old.reddit.com.		300	IN	CNAME	reddit.map.fastly.net.
reddit.map.fastly.net.	30	IN	A	151.101.121.140

These DNS records have short TTL, less than 8 minutes.
It is expected behaviour that a cached record is discarded when its TTL 
expires.
Check if BIND has options to force a minimal TTL on cached records.

[toc] | [prev] | [next] | [standalone]


#200355 — [SOLVED] Re: Bind: A caching local server caches but not for long

Fromlocal10 <local10@tutanota.com>
Date2018-09-20 22:20 +0200
Subject[SOLVED] Re: Bind: A caching local server caches but not for long
Message-ID<wAdAB-7Ff-7@gated-at.bofh.it>
In reply to#200208
Sep 16, 2018, 6:40 PM by pascal@plouf.fr.eu.org:

> old.reddit.com.		300	IN	CNAME	reddit.map.fastly.net.
> reddit.map.fastly.net.	30	IN	A	151.101.121.140
>
> These DNS records have short TTL, less than 8 minutes.
> It is expected behaviour that a cached record is discarded when its TTL expires.
> Check if BIND has options to force a minimal TTL on cached records.
>

Bind, as I understand it, does not have a setting that allows to change the minimal TTL but unbound and dnsmasq (the later versions)  do. Instead of installing unbound or dnsmasq I decided to simply update the /etc/hosts file with the IPs of the non-critical sites I use most often. Works well enough. Regards,

[toc] | [prev] | [next] | [standalone]


#200215

FromMichael Stone <mstone@debian.org>
Date2018-09-17 13:30 +0200
Message-ID<wyZT3-5dw-7@gated-at.bofh.it>
In reply to#200207
On Mon, Sep 17, 2018 at 12:20:51AM +0200, local10 wrote:
>;; ANSWER SECTION:
>old.reddit.com.         241     IN      CNAME   reddit.map.fastly.net.
>reddit.map.fastly.net.  8       IN      A       151.101.21.140

this number              ^^^
is the TTL/"time to live" in seconds. It is set by the server 
distributing the records and is typically set to something fairly long, 
like a day or more, for domains which don't change much. For domains 
which do change often, or if a move is planned in the near future, the 
TTL may be set low so that old records aren't cached long after they're 
obsolete. In this case the TTL in your cache shows 241 seconds left for 
old.reddit.com and 8 seconds remaining for reddit.map.fastly.net. By 
checking the authoritative nameservers directly it seems that the former 
is never more than 5 minutes while the latter is set to only 30 seconds. 
So your caching server should be updating fairly often.

Mike Stone

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web