networking

Stands for: Time To Live

A counter that limits how long data lives or how far a packet may travel before being discarded.

In DNS, TTL is how many seconds a record may be cached before it must be looked up again; in IP, it is the hop limit that stops a lost packet from circling forever. Same name, two jobs, both about bounding lifetime.

RFC 791 defines the IPv4 field, 8 bits, as the maximum time in seconds a datagram may remain in the internet, but every module must decrease it by at least one, so in practice it counts hops. RFC 1812 has each router subtract at least one, discard the packet at zero and, unless the destination is multicast, send an ICMP Time Exceeded to the source. IPv6 calls the field Hop Limit and, as RFC 8200 explains, no longer enforces a lifetime. The rule ends routing loops, and traceroute uses it on purpose, sending probes with TTL 1, 2, 3 so that each router in turn answers.

In DNS the TTL is a 32-bit count of seconds that a record may be cached before the source is consulted again. RFC 2181 fixed the range at 0 to 2147483647 and made it a maximum, not a mandatory time: a cache may shorten it, and a cached copy counts down, so a TTL that falls between two queries shows that a cache answered.

Changes follow from it. A resolver that holds the old record keeps serving it until the countdown ends, and lowering the TTL afterwards does not reach copies already cached, so RFC 1034 advises reducing it before an anticipated change and raising it again once the change is done.

Also known as: ttl, time to live, hop limit

← All glossary entries