define how long will DNS cache stay in local DNS server
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
[root@NS1 data]# dig +ttlid www.google.com
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.30.rc1.el6_6.3 <<>> +ttlid www.google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 20502
;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 13, ADDITIONAL: 0
;; QUESTION SECTION:
;www.google.com. IN A
;; ANSWER SECTION:
www.google.com. 214 IN A 173.194.33.147
www.google.com. 214 IN A 173.194.33.145
www.google.com. 214 IN A 173.194.33.146
www.google.com. 214 IN A 173.194.33.144
www.google.com. 214 IN A 173.194.33.148
;; AUTHORITY SECTION:
. 79707 IN NS g.root-servers.net.
. 79707 IN NS j.root-servers.net.
. 79707 IN NS d.root-servers.net.
. 79707 IN NS m.root-servers.net.
. 79707 IN NS l.root-servers.net.
. 79707 IN NS b.root-servers.net.
. 79707 IN NS e.root-servers.net.
. 79707 IN NS h.root-servers.net.
. 79707 IN NS a.root-servers.net.
. 79707 IN NS c.root-servers.net.
. 79707 IN NS k.root-servers.net.
. 79707 IN NS i.root-servers.net.
. 79707 IN NS f.root-servers.net.
;; Query time: 214 msec
;; SERVER: 10.200.10.10#53(10.200.10.10)
;; WHEN: Fri Jul 10 13:13:15 2015
;; MSG SIZE rcvd: 323
214 is the seconds that how long will this query result stay in DNS Server 's DNS cache, and it is too short , i want to change it to a large number that Intranet DNS server will response from its cache directly instead of query root-servers when the same query reach it.
but we can not modify zone files' paramaters from those DNS server we query to ? right ?
is it any way we can do it locally ?
like google's dns set it cache expiration time up to 600s , but we want the query result stay in our dns cache for 1 day.
You can set the TTL parameter on a DNS server that is under your control. I was under the impression that this is your goal - you say "but we want the query result stay in our dns cache for 1 day". The easiest solution is to add a line "$TTL 1d" at the beginning of your zone file. This sets the TTL for all addresses. Or you can set it per address, as shown in the Zytrax tutorial I mentioned.
I think you can also set TTL in your name server's config file but the details depend on the name server and the Linux distro.
You can set the TTL parameter on a DNS server that is under your control. I was under the impression that this is your goal - you say "but we want the query result stay in our dns cache for 1 day". The easiest solution is to add a line "$TTL 1d" at the beginning of your zone file. This sets the TTL for all addresses. Or you can set it per address, as shown in the Zytrax tutorial I mentioned.
I think you can also set TTL in your name server's config file but the details depend on the name server and the Linux distro.
if i create a zone file on my own name's server for google.com, i m not able to add all of A record under google.com, though it is help me to solve my first problem, isn't it ?
Please explain why you think overriding their times is sensible. Do you know better than Google, how their own servers operate?
Unbound's "prefetch" option is a nice, related feature
well, when cache expiratime time was set up to 600s by google public dns server, when the time is up, local dns server will query what it did before , mostly , root server will return a same result to our local dns ,and then cache them again. of course , sometimes , the result is different , but it won't affect any thing.
so , how many times would Local dns query for a same domain address. those query data consum lot of bandwidth in your network. why don't we tell those cache stay longer?
I repeat: Do you know better than Google, how their own servers operate?
No, of course you don't.
Google (and NSA) pretty much run a hefty chunk of the Internet - I think it's pretty funny that you think you can second-guess their DNS settings.
The bandwidth from these DNS lookups is *insignificant*. If you think it's significant, then I bet you aren't running e.g. Unbound or dnsmasq on the relevant PCs, for local caching.
I repeat: Do you know better than Google, how their own servers operate?
No, of course you don't.
Google (and NSA) pretty much run a hefty chunk of the Internet - I think it's pretty funny that you think you can second-guess their DNS settings.
The bandwidth from these DNS lookups is *insignificant*. If you think it's significant, then I bet you aren't running e.g. Unbound or dnsmasq on the relevant PCs, for local caching.
yes . you're right about google . i run bind 9.8 on a Centos 6.6 , so do you have any solution of bind to make cache stay a little longer ?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.