Time to Live, or TTL for short, is basically a limit on how long a packet gets to keep travelling before a router bins it. It sounds like a countdown timer, but it isn’t measured in seconds. It’s just a number tucked inside the IP packet.

Say your computer sends a packet off to a website. It has to hop through a bunch of routers to reach the server. Every router that passes it along takes 1 off the TTL, and if the number hits zero before the packet arrives, that router drops it and that’s the end of it.

What Happens to TTL on the Way?

Picture a packet that starts with a TTL of 5. The first router makes it 4, the next makes it 3, then 2, then 1. If yet another router needs to forward it, the TTL is now zero and the packet gets thrown away.

Why do this at all? Because networks mess up sometimes. A routing problem can send a packet round and round between the same few routers, and without TTL it would just keep circling and wasting resources. So TTL is a safety limit. A packet doesn’t get endless chances to wander.

It Isn’t Really About Time

The name doesn’t help. It sounds like every packet gets, say, 30 seconds to live, and that’s not how it normally works. The number actually counts router hops, which just means one step from one router to the next.

That’s a big part of why it works so well. Routers don’t need to keep track of how old a packet is. They change one number and pass it on.

Why Would a Packet Need to Die?

A friend of mine had a weird network problem at home once. His laptop kept throwing an error whenever he tried to reach one particular service, and he sat there refreshing the same pages hoping it would sort itself out.

A packet stuck in a routing loop is that same headache on a much bigger scale. It keeps going around and never gets where it’s meant to go. TTL gives the network a way to call time on it. When a router drops a packet because its TTL ran out, it can send an ICMP message back to whoever sent it, and traceroute makes clever use of exactly that.

TTL and Traceroute

This is where TTL gets kind of fun. Traceroute sends packets with very low TTL values on purpose. The first one starts at 1, so the first router drops it and replies. The next starts at 2, so it gets past the first router and dies at the second. Every reply shows you another router on the path. Some networks just don’t answer these messages, so the picture isn’t always complete.

What It Looks Like in Real Networks

Different operating systems start packets with different default TTL values. You’ll often see 64 or 128, depending on the system. You almost never need to touch it. Your operating system sets it and routers quietly count it down as the packet moves along. Which is how good networking stuff should feel. Nobody wants to think about it every five minutes.

TTL is simple on purpose. A packet gets a limit, routers chip away at it, and eventually the packet has to stop. Without that one tiny number, a single routing mistake could leave a packet that refuses to leave, and you’d have millions of them doing it. Suddenly a little counter seems pretty handy.