Time-to-live (TTL) is a value in an Internet Protocol (IP) packet that tells a network router whether or not the packet has been in the network too long and should be discarded. In IPv6 the TTL field in each packet has been renamed the hop limit.
By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
An IP TTL is set initially by the system sending the packet. It can be set to any value between 1 and 255; different operating systems set different defaults. Each router that receives the packet subtracts at least 1 from the count; if the count remains greater than 0, the router forwards the packet, otherwise it discards it and sends an Internet Control Message Protocol (ICMP) message back to the originating host, which may trigger a resend.
The point of the TTL/hop limit is to keep streams of undeliverable packets stuck in routing loops (perhaps due to incorrect routing tables) from circulating forever and clogging up the networks in question. In Multiprotocol Label Switching (MPLS) clouds, the MPLS TTL is copied from the IP TTL when the IP packet enters the cloud. On egress, the MPLS TTL value is copied into the IP TTL field (as long as it is less than the value in the field).
The ping and the traceroute utilities both make use of the TTL value to attempt to reach a given host computer or to trace a route to that host. Traceroute sends a stream of packets with successively higher TTLs so each will be discarded in turn by the next hop (router) on the route to the destination: The first packet has a TTL of one and is discarded by the first router, the second has a TTL of two and is discarded by the next router, and so on. The time between sending the packet and receiving back the ICMP message that it was discarded is used to calculate each successive hop travel time.
In IP multicast, the TTL controls the scope or range in which a packet may be forwarded. By convention:
- 0 is restricted to the same host
- 1 is restricted to the same subnet
- 32 is restricted to the same site
- 64 is restricted to the same region
- 128 is restricted to the same continent
- 255 is unrestricted
The term time-to-live is also used to describe the time for which a DNS record can be returned from cache. In this context, TTL is a numerical value, set in a DNS record on the authoritative DNS server for the domain, defining the number of seconds for which a caching server can provide its cached value for the record. When that many seconds have elapsed since the last refresh, the caching server will reach out to the authoritative server again and receive the current (and possibly changed) value for the record.
In HTTP, time-to-live describes the number of seconds for which which cached Web content can be returned before the Web server is required to check again that it is still "fresh." A default value is defined by settings on the Web server, but can be overridden by cache-control tags (which define which kinds of servers, if any, can cache the data) or expires tags (which define a date and time at which the content is stale) in HTML page headers.