Time to live
TTL or Time To Live is an 8-bit field found in the header of IPv4 packets that is used to prevent packets from looping forever within an IP network.
The TTL is usually set to 255 or 64 by the initial sender (depending upon the OS of the sending device). Every time an IP packet passes through a router, the time to live field is decremented by 1. Once it hits 0 the router will drop the packet and sends an ICMP time exceeded message to the sender.
The TTL is used as a last resort to ensure that IP packets do not continuously roam the network forever if there is some misconfiguration or network fault. Since it is a last resort, it is rare that it is ever needed to get rid of such packets. In most cases, packets will either reach their destination, will be dropped due to lack of a route, or be dropped due to other loop prevention mechanisms such as those implemented by routing protocol such as OSPF, EIGRP, or BGP.
it is generally accepted that you should be able to reach any destination on the Internet within 30 hops under normal circumstances. However, the reason the default TTL is set so high is that, you may have situations when there is a routing problem on the internet that may cause this number to increase. So setting the initial value of the TTL to 64 or even 255 ensures that you’re not prematurely dropping packets that would have eventually reached their destination, albeit after an unusually high number of hops. Any packets that do exceed 64 hops are likely not going to reach their destinations, so they are dropped outright.
TTL is extensively used in various other mechanisms including the following:
- OSPF TTL Security Check
- TTL of 2 for EIGRP and RIP Packets
- Traceroute makes extensive use of the TTL feature
- eBGP peerings also use TTL