Currently dns cache time on my ubuntu 17.10 is 300 seconds.

Using command:

dig +ttlid copyleaks.com

Gives me:

; <<>> DiG 9.10.3-P4-Ubuntu <<>> +ttlid copyleaks.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 19394
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
; EDNS: version: 0, flags:; udp: 65494
;copyleaks.com.                 IN      A
copyleaks.com.          299     IN      A
copyleaks.com.          299     IN      A
;; Query time: 9 msec
;; WHEN: Tue Apr 03 11:46:42 UTC 2018
;; MSG SIZE  rcvd: 74

While after the domain you can see that its cached for 299 seconds and on subsequent queries its going down.

How can I set caching time to a different value?

Is there a way to set a value for a specific domain?


Every domain has timeouts defined in its SOA record (try dig SOA copyleaks.com). If you are the administrative authority for the domain, then you can setup the SOA record and setup your default cache times there. Then there are timeouts for each record, and I think this is the case in your example, where A record copyleaks.com (try dig A copyleaks.com) has a timeout of 300 seconds, which is different than timeout in SOA record. Every domain administrator sets the TTL (Time To Leave) times to a value that makes sure that DNS records are updated frequently enough and that they are not transferred too frequently from administrative servers.

For SOA record take a look here: https://en.wikipedia.org/wiki/SOA_record. If you want to learn more about DNS I would recommend this http://shop.oreilly.com/product/9780596100575.do.

Try your command for other domains and you will see different values.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.