mail us  |  mail this page

contact us
training  | 
tech stuff  | 

Time-to-Live (TTL) Values

The $TTL directive is defined in RFC 2308.

TTL in the DNS context defines the duration in seconds that the record may be cached by any resolver. Zero indicates the record should not be cached. Note: RFC 1912 cautions that 0 = no caching may not be widely supported, however most modern DNS software does support the feature. TTL values of 0 should be used with extreme care since, depending on the type of RR to which they are applied, they can create significant loads on both the Resolver (caching Name Server) and the Authoritative Name Servers as well as significantly increase latency times for all transactions.

A more extensive discussion about Sensible TTL values can be found here.

The default TTL for the zone is defined in BIND9 by the $TTL directive which must appear at the beginning of the zone file, that is, before any RR to which it will apply. This $TTL is used for any Resource Record which does not explicitly set the 'ttl' field.

The TTL field is defined to be an unsigned 32 bit value with a valid range from 0 to 2147483647 (clarified in RFC 2181) - which is a long time! - somewhere on the other side of 68 years.

The $TTL field may take any time value.

In BIND 8 the SOA record (minimum parameter) was used to define the zone default TTL value. In BIND 9 the SOA 'minimum' parameter is used as the negative (NXDOMAIN) caching time (defined in RFC 2308).

RFC 1912 recommends that the $TTL value be set to 1 day or longer and that certain RRs which rarely change, such as the MX records for the domain, use an explicit TTL value to set even longer values such as 2 to 3 weeks. The value of any TTL is a balance between how frequently you think the DNS records will change vs load on the DNS server. In the example below the $TTL value of 2d (2 days) indicates that any change (in this case to the www entry only, since all other RRs have explicit TTL values) may not be fully propagated for 48 hours. In most cases this will not be a problem since IP address changes are normally planned in advance, in which case in advance of the change process the TTL could be reduced to 3h to 12h and then restored to a higher value when the change has stabilized. An alternative, lower risk, strategy may be to define the new IP address using a second www A RR (thus maintaining two web services during a transitional period). Once the change has stabilized remove the old www A RR wait a further 48 hours and then retire the old web service.

Example

; example.com zone file fragment 
$TTL 2d ; zone default
      3w   IN      MX  10 192.168.254.2  ; overrides default     
joe   3h   IN      A      192.168.254.3  ; overrides default     
www        IN      A      192.168.254.3  ; uses zone default = 2 days



Problems, comments, suggestions, corrections (including broken links) or something to add? Please take the time from a busy life to 'mail us' (at top of screen), the webmaster (below) or info-support at zytrax. You will have a warm inner glow for the rest of the day.

Pro DNS and BIND by Ron Aitchison

Contents

tech info
guides home
dns articles
intro
contents
1 objectives
big picture
2 concepts
3 reverse map
4 dns types
quickstart
5 install bind
6 samples
reference
7 named.conf
8 zone records
operations
9 howtos
10 tools
11 trouble
programming
12 bind api's
security
13 dns security
bits & bytes
15 messages
resources
notes & tips
registration FAQ
dns resources
dns rfcs
change log

Creative Commons License
This work is licensed under a Creative Commons License.

If you are happy it's OK - but your browser is giving a less than optimal experience on our site. You could, at no charge, upgrade to a W3C STANDARDS COMPLIANT browser such as Firefox

Search

web zytrax.com

Share

share page via facebook tweet this page

Page

email us Send to a friend feature print this page Decrease font size Increase font size Display full width page

Resources

Systems

FreeBSD
NetBSD
OpenBSD
DragonFlyBSD
Linux.org
Debian Linux

Software

LibreOffice
OpenOffice
Mozilla
GitHub
GNU-Free SW Foundation
get-dns

Organizations

Open Source Initiative
Creative Commons

Misc.

Ibiblio - Library
Open Book Project
Open Directory
Wikipedia

Site

CSS Technology SPF Record Conformant Domain
Copyright © 1994 - 2017 ZyTrax, Inc.
All rights reserved. Legal and Privacy
site by zytrax
Hosted by super.net.sg
web-master at zytrax
Page modified: November 24 2015.