LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 07-10-2015, 12:22 AM   #1
gbcbooks
Member
 
Registered: Aug 2014
Posts: 199

Rep: Reputation: Disabled
define how long will DNS cache stay in local DNS server


can we define TTL value for Cache in DNS server ?

for example

i queried www.google.com in local DNS server, the query result to www.google.com as below
Code:
[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.
 
Old 07-10-2015, 01:21 AM   #2
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Look up $TTL, for example here: http://www.zytrax.com/books/dns/apa/ttl.html
 
Old 07-10-2015, 02:27 AM   #3
gbcbooks
Member
 
Registered: Aug 2014
Posts: 199

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by berndbausch View Post
Look up $TTL, for example here: http://www.zytrax.com/books/dns/apa/ttl.html
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.
 
Old 07-10-2015, 03:17 AM   #4
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by gbcbooks View Post
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.
 
Old 07-10-2015, 03:27 AM   #5
brebs
Member
 
Registered: May 2013
Posts: 89

Rep: Reputation: Disabled
Quote:
Originally Posted by gbcbooks View Post
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.
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
 
Old 07-10-2015, 05:22 AM   #6
gbcbooks
Member
 
Registered: Aug 2014
Posts: 199

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by berndbausch View Post
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 ?
 
Old 07-10-2015, 05:32 AM   #7
gbcbooks
Member
 
Registered: Aug 2014
Posts: 199

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by brebs View Post
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?
 
Old 07-10-2015, 05:42 AM   #8
brebs
Member
 
Registered: May 2013
Posts: 89

Rep: Reputation: Disabled
"mostly", hmmm?

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.
 
Old 07-10-2015, 07:55 AM   #9
gbcbooks
Member
 
Registered: Aug 2014
Posts: 199

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by brebs View Post
"mostly", hmmm?

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 ?
 
Old 07-13-2015, 01:44 AM   #10
gbcbooks
Member
 
Registered: Aug 2014
Posts: 199

Original Poster
Rep: Reputation: Disabled
any one here ?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Managed DNS server lists and dnsmasq DNS cache nitrousoxide82 Linux - Networking 1 02-21-2014 10:34 PM
can a local DNS Server be used to handle dns requests going out to the internet baronobeefdip Linux - Server 1 07-03-2012 03:19 AM
local dns server cache size optimization flux242 Linux - Networking 1 04-25-2011 01:22 PM
Redirect local DNS query to remote DNS server on non standard port? rock_ya_baby Linux - Server 8 04-13-2010 04:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration