How can I increase the TTL for the cached entries in my local dns serveder?

Hongyi Zhao hongyi.zhao at
Fri Mar 28 06:09:19 UTC 2014

Hi all,

Currently, I use bind9 as the local dns cache server and a forwarder only

I set the dnscrpyt-proxy running on local port 50 as the upstream dns
server  for my bind9 dns cache server.

In addtition, I also want to have long TTL so that I can obtain a short
inquiry respond time.

For all of the above purposes, I use the following configure file:

$ cat /etc/bind/named.conf.options
options {
    directory "/var/cache/bind";

    // If there is a firewall between you and nameservers you want
    // to talk to, you may need to fix the firewall to allow multiple
    // ports to talk.  See

    // If your ISP provided one or more IP addresses for stable
    // nameservers, you probably want to use them as forwarders.
    // Uncomment the following block, and insert the addresses replacing
    // the all-0's placeholder.

    // forwarders {
    // };

        forward only;
        forwarders { port 50 ;} ;

        cleaning-interval 1440;
    max-cache-ttl 2419200;
    max-ncache-ttl 86400;
    max-cache-size unlimited;
    stacksize unlimited;
    datasize unlimited;
    coresize unlimited;

    // If BIND logs error messages about the root key being expired,
    // you will need to update your keys.  See

//    dnssec-validation auto;

    auth-nxdomain no;    # conform to RFC1035
    listen-on-v6 { any; };

Then I restart my dns server with the followoing command to let the above
config take in effect:

sudo service bind9 restart

But, I still have low TTL, because I've tried that the following command:

werner at debian:~$ dig

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

;        IN    A

;; ANSWER SECTION:    60    IN    CNAME    60    IN    A    60    IN    A    60    IN    A    60    IN    A    60    IN    A    60    IN    A    60    IN    A    60    IN    A    60    IN    A    60    IN    A    60    IN    A    60    IN    A    60    IN    A    60    IN    A

;; Query time: 1208 msec
;; WHEN: Fri Mar 28 14:04:01 2014
;; MSG SIZE  rcvd: 292

Though in above query, the query time is 1208 msec, if I immediately do the
second query, the query time will be dramtically shorttened.  But after
several minites, I will still obtain a long  query time as the above one.
The OS used by me is Debian GNU/Linux 7.4 (wheezy).

Any hints on this issue?

Hongyi Zhao <hongyi.zhao at>
Xinjiang Technical Institute of Physics and Chemistry
Chinese Academy of Sciences
GnuPG DSA: 0xD108493
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the bind-users mailing list