Re: Caching nameserver

From: Cameron Kerr (cameron.kerr_at_paradise.net.nz)
Date: 06/29/04


Date: 30 Jun 2004 04:59:18 +1200

Randy Sparks <none@none.com> wrote:

> So far so good. The trouble is that 10 or so minutes later, digging
> google.com means a fresh TLD lookup, and another half second wait. Then
> after this it's back to 3ms.
>
> I believe that the TLDs themselves set the expiration time for each record,
> but surely 10 minutes is too brief a time?

That decision would be made by Google usually (in this case, they can
tell their registrar to specify a particular TTL for their NS and glue A
records.

Specifying short TTLs is useful for a number of reasons, but it does
come as a tradeoff to DNS server load (in this case, Google's, not yours).
Here are the common motivations for using short TTLs

 * Allows the administrator to change DNS data and know that everyone
   should have the new data in a reasonably short timeframe. Examples of
   this could be DynDNS, so that when someones IP address changes, the A
   record in the DNS system will be the old value only for a short
   period of time.

   Another common scenario for changing TTL value to a smaller value is
   when you can know you are about to change the address of a machine
   (perhaps you're moving a machine to a different provider). You
   minimise the TTL so that the change can be picked up quickly, then
   when you get it into its new location, you put the TTL to its
   original value.

 * When doing round-robin DNS for doing load-distribution of webservers,
   using a shorter TTL helps to smooth out the load.

Using dig, we can see what the TTL for google.com is

$ dig google.com

;; ANSWER SECTION:
google.com. 98 IN A 216.239.57.99
google.com. 98 IN A 216.239.37.99
google.com. 98 IN A 216.239.39.99

As you can see, google is distributing the load (this may also be for
redundancy), and each query should be cached only for 98 seconds (or at
least, this is how long _my_ DNS server has left before it expires that
record. To get the original TTL, query googles DNS servers directly.

$ dig +short -t ns google.com
ns2.google.com.
ns3.google.com.
ns4.google.com.
ns1.google.com.

$ dig @ns1.google.com google.com

;; ANSWER SECTION:
google.com. 300 IN A 216.239.39.99
google.com. 300 IN A 216.239.37.99
google.com. 300 IN A 216.239.57.99

So we can see, the entries are to be cached for no longer than 300
seconds (5 minutes).

> Is there any way to override
> this setting? Ideally I'd like records to be cached for 24 hours.

You should _not_ do this. I don't believe standard Bind can rewrite data
in this anyway.

If you want to speed up lookups, I urge you to use your ISPs nameservers
as forwarders.

-- 
Cameron Kerr
cameron.kerr@paradise.net.nz : http://nzgeeks.org/cameron/
Empowered by Perl!


Relevant Pages

  • Re: Deathrow Cluster down again
    ... problem with Verizon (or even Verizon in Boston) ... Configuring a DNS server is not terribly difficult these days. ... Once you are satisfied that everything is working correctly, you should increase the TTL to at least twenty-four hours. ...
    (comp.os.vms)
  • Re: PTR? what the heck is it?
    ... > zero, why should mail be blocked because of that? ... > to live) merely tells the DNS server how long to refresh ... how would that be associated to potential spam? ... > that i set my TTL to 30... ...
    (comp.security.misc)
  • Re: Migrating to new ISP
    ... I'm looking for advice on moving to a new ISP in a smooth manner with little or no down time to our public websites, ... Change the TTL to something small at LEAST one full TTL period ahead of the ... We have two public facing DNS server, ...
    (microsoft.public.win2000.dns)
  • Re: Windows 2003 R2 SP2 DNS Event ID 3000
    ... The DNS server sometime got Event ID 3000 error on event log ... recursion avail. ... refresh = 900 (15 mins) ... default TTL = 3600 ...
    (microsoft.public.win2000.dns)
  • Re: which NS record will be cached?
    ... I have one question about NS cache ttl. ... $ dig google.com ns +trace ... so, on resolving DNS, which NS record TTL will be cached generally? ...
    (comp.protocols.dns.bind)