Definition

time-to-live (TTL)

What is time-to-live (TTL)?

Time-to-live (TTL) is a value for the period of time that a packet, or data, should exist on a computer or network before being discarded.

The meaning of TTL, or packet lifetime, depends on the context. For example, TTL is a value in an Internet Protocol (IP) packet that tells a network router when the packet has been in the network too long and should be discarded.

structure of a network packet
The time-to-live value instructs a network router when a packet should be discarded.

What is time-to-live in networking?

TTL is deployed as a counter or timestamp embedded in each packet. When the predefined timespan or event count expires, the packet is either discarded or revalidated.

In networking, TTL prevents data packets from moving across the network indefinitely. In applications, TTL manages data caching and boosts performance. TTL is also used in other contexts, such as content delivery network caching and domain name system (DNS) caching.

How does time-to-live work?

Administrators can set TTL to any value between 1 and 255. However, different operating systems support setting different defaults.

When a packet is by a router, the router subtracts 1 from the TTL count. Then, the packet travels to the next destination on the network. When the TTL count is 0, after the final subtraction, the packet is discarded by the router. This triggers an Internet Control Message Protocol (ICMP) message that's sent back to the originating host.

The point of TTL, also referred to as hop limit, is to keep streams of undeliverable packets that are stuck in routing loops -- perhaps due to incorrect routing tables -- from circulating forever and clogging the networks.

In Multiprotocol Label Switching clouds, the MPLS TTL is copied from the IP TTL when the IP packet enters the cloud. When it leaves, the MPLS TTL value is copied to the IP TTL field -- if it is less than the value in the field.

basic Multiprotocol Label Switching (MPLS) structure
Time-to-live in MPLS clouds is copied from the IP TTL when the IP packet enters the cloud.

In addition to limiting the lifespan of a data packet, TTL helps determine how long a packet has been in circulation and how long it will continue to move through the network. This information provides the sender details about the packet's path through the internet.

What is time-to-live in pinging?

Standard network commands, or utilities, like traceroute and ping, use TTL to reach the host or trace a route to that host. Ping is used prior to using traceroute to determine whether a host is on the network. Traceroute records the route at each hop through the internet between a computer and a specified destination.

At each step, or hop, along the route, one of the packets -- which includes a TTL value -- reaches its last stop. At that location, the utility sends an ICMP message to the sender after discarding the packet. Once the time limit value for the first hop is determined, traceroute increases the time value limit and resends the packet to the second destination -- and so on.

At the final hop, traceroute records are displayed hop by hop.

Time-to-live for each interface of each router
Time-to-live ping detail

In IP multicast, the scope or range of forwarded packets are managed with TTL controls --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.

What is time-to-live in DNS?

The term time-to-live can describe the time that a DNS record is returned from the cache. In this context, TTL is a numerical value set in a DNS record on the authoritative domain name server for the domain.

It defines the number of seconds that a cache server can provide its cached value for the record. When the defined number of seconds have passed 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.

how DNS works
Time-to-live is used in DNS caching and in other contexts within networking.

What is time-to-live in HTTP?

In Hypertext Transfer Protocol (HTTP), time-to-live describes the number of seconds it takes for cached web content to return before the web server has to check again to ensure that the content is "fresh."

Settings on the web server define a default value. Still, cache-control tags, which define the kinds of servers, if any, can cache the data, or expired tags, which represent a date and time when the content is stale, can override it in the HyperText Markup Language page headers.

What is time-to-live exceeded?

TTL exceeded refers to IP packets carrying web HTTP traffic over Transmission Control Protocol that have crossed too many router hops.

In this scenario, each router reduces the TTL field of the IP packets sent across the network until it reaches 0. Then, the router drops the IP packet and responds to the sender with an ICMP packet and a TTL exceeded error code.

What is time-to-live in DynamoDB?

In Amazon DynamoDB -- a NoSQL document database service -- TTL lets users define a per-item timestamp to determine when an item is not needed anymore.

When the specified timestamp elapses, DynamoDB deletes the item from the table without consuming any write throughput.

This was last updated in July 2021

Continue Reading About time-to-live (TTL)

Dig Deeper on Network protocols and standards

SearchUnifiedCommunications
SearchMobileComputing
SearchDataCenter
SearchITChannel
Close