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.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.
3 reverse map
4 dns types
5 install bind
8 zone records
12 bind api's
13 dns security
bits & bytes
notes & tips
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