5

When an IPv4 packet traverses a router or is processed by a host, the TTL is decremented and if the TTL is too low, the packet is dropped.

My questions are:

  • When is the TTL decremented? Before or after the packet is considered for dropping?
  • What is the drop condition? Is it if the TTL=0? Or is it if the TTL would be 0 if the TTL were decremented? Something else?
  • Do certain types of networking hardware behave differently than others? For example, if a router would drop a packet received with TTL=0, would a host also drop this, or would it forward it to the client?

From this forum post, it appears that the answer to the first question is usually that the TTL is decremented only once the router has decided not to drop the packet, and that the drop condition is that the the packet is dropped if the TTL=0 on the received packet.

What that really leaves is:

  • Is there more nuance to these answers than that forum post would make it seem?
  • If a router would drop a packet, is a host delivering a packet to a client considered to be a "hop" (and thus the packet is dropped), or not?
7

What you are looking for is specified in RFC1812. To answer your specific questions:

The router would drop the packet when it sees the TTL is too low after it decides to forward it:

Note in particular that a router MUST NOT check the TTL of a packet except when forwarding it.

A router MUST NOT originate or forward a datagram with a Time-to-Live (TTL) value of zero.

A router MUST NOT discard a datagram just because it was received with TTL equal to zero or one; if it is to the router and otherwise valid, the router MUST attempt to receive it.

The receiving host doesn't check the TTL so even though a packet with TTL 0 should not be sent the receiving host will process it anyway:

TTL expiration is intended to cause datagrams to be discarded by routers, but not by the destination host.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.