From LQWiki
Jump to: navigation, search

TTL stands for Time-To-Live. It refers to the number of hops (or nodes) a packet can take before it is declared dead, and an error message sent back to the originating host.

The purpose of the TTL is to ensure the mortality of packets. If two routers, by accident, have each other as the route of the packet (a network loop), they will keep bouncing it back and forth indefinitely. The TTL, which is decremented each time the packet is received, will eventually reach 0 and thus cause the packet to die.

TTL values depend on the operating system that sent the packet. Linux and most others use 64, as recommended in RFC1700 (Assigned Numbers). Windows NT 3.51 and earlier used 32, later 128. Linux lets you adjust the value through procfs, by writing or reading /proc/sys/net/ipv4/ip_default_ttl

The TTL is used by the traceroute program to measure the path a packet takes, by sending a probe with a TTL of 1, making the first node in the route report an error and thus making itself known. The next probe will have a TTL of 2, revealing the second node, and so on until the target IP address is reached.