3

I am having some confusion while calculating he minimum hop limit ... consider following scenario:

(source)-------(R1)--------(R2)--------(destination)

Now when an IP datagram is supposed to travel from source to destination, what is minimum hop limit value?

is it 2 or 3 (more generally 'n' or 'n+1', where n is number of routers in between)?

I think it is 3

If hop limit is 2, then it will be discarded at R2

(Source)-------"hop limit is 2"----------(R1)------"hop limit is 1"-------(R2) ||(hop limit is 0 so discarded)

So a generalization would be: minimum hop limit should be "n+1"

Correct me if am wrong.Thanks in advance

1
  • Router generally reduce TTL by 1. But it's not necessarily. Router can (depending on its settings) reduce TTL by more than 1 (with the aim of increase the cost of routing and accordingly decrease traffic in multi-path environment), or, in contrary, can do not alter TTL at all (hide self). minimum hop limit should be "n+1" - correct.
    – user36844
    Aug 23, 2017 at 18:18

2 Answers 2

3

What you need to understand about the IPv4 TTL or IPv6 Hop Limit value is that a router (supposed to be the end-host, too, for IPv4, but most OSes don't do this) will decrement the IPv4 TTL or IPv6 Hop Limit when it receives a packet, and it will discard the packet if it decrements to 0.

That means that a packet with a IPv4 TTL or IPv6 Hop Limit of 1 entering a router will result in the router discarding the packet because it will be decremented to 0.


For IPv4, see RFC 791, Internet Protocol:

The Time to Live is an indication of an upper bound on the lifetime of an internet datagram. It is set by the sender of the datagram and reduced at the points along the route where it is processed. If the time to live reaches zero before the internet datagram reaches its destination, the internet datagram is destroyed. The time to live can be thought of as a self destruct time limit.

-and-

Time to Live: 8 bits

This field indicates the maximum time the datagram is allowed to remain in the internet system. If this field contains the value zero, then the datagram must be destroyed. This field is modified in internet header processing. The time is measured in units of seconds, but since every module that processes a datagram must decrease the TTL by at least one even if it process the datagram in less than a second, the TTL must be thought of only as an upper bound on the time a datagram may exist. The intention is to cause undeliverable datagrams to be discarded, and to bound the maximum datagram lifetime.

-and-

Time to Live

The time to live is set by the sender to the maximum time the datagram is allowed to be in the internet system. If the datagram is in the internet system longer than the time to live, then the datagram must be destroyed.

This field must be decreased at each point that the internet header is processed to reflect the time spent processing the datagram. Even if no local information is available on the time actually spent, the field must be decremented by 1. The time is measured in units of seconds (i.e. the value 1 means one second). Thus, the maximum time to live is 255 seconds or 4.25 minutes. Since every module that processes a datagram must decrease the TTL by at least one even if it process the datagram in less than a second, the TTL must be thought of only as an upper bound on the time a datagram may exist. The intention is to cause undeliverable datagrams to be discarded, and to bound the maximum datagram lifetime.

Some higher level reliable connection protocols are based on assumptions that old duplicate datagrams will not arrive after a certain time elapses. The TTL is a way for such protocols to have an assurance that their assumption is met.


For IPv6 see RFC 2460, Internet Protocol, Version 6 (IPv6) Specification:

Hop Limit

8-bit unsigned integer. Decremented by 1 by each node that forwards the packet. The packet is discarded if Hop Limit is decremented to zero.

-and-

        if the IPv6 Hop Limit is less than or equal to 1 {
           send an ICMP Time Exceeded -- Hop Limit Exceeded in
           Transit message to the Source Address and discard the
           packet
        }
        else {
           decrement the Hop Limit by 1

           resubmit the packet to the IPv6 module for transmission
           to the new destination
        }

Notice that it says, "if the IPv6 Hop Limit is less than or equal to 1," the packet is discarded.

-and-

8.2 Maximum Packet Lifetime

Unlike IPv4, IPv6 nodes are not required to enforce maximum packet lifetime. That is the reason the IPv4 "Time to Live" field was renamed "Hop Limit" in IPv6. In practice, very few, if any, IPv4 implementations conform to the requirement that they limit packet lifetime, so this is not a change in practice. Any upper-layer protocol that relies on the internet layer (whether IPv4 or IPv6) to limit packet lifetime ought to be upgraded to provide its own mechanisms for detecting and discarding obsolete packets.


Edit:

Here is an example where I pinged the next-hop router VLAN interface, and then I pinged the router Loopback0 interface, with a TTL of 1. I received ICMP replies for every ping attempt, but the pings to the loopback expired in transit:

D:\>ping 198.18.1.1

Pinging 198.18.1.1 with 32 bytes of data:
Reply from 198.18.1.1: bytes=32 time<1ms TTL=128
Reply from 198.18.1.1: bytes=32 time<1ms TTL=128
Reply from 198.18.1.1: bytes=32 time<1ms TTL=128
Reply from 198.18.1.1: bytes=32 time<1ms TTL=128

Ping statistics for 198.18.1.1:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

D:\>ping -i 1 198.0.0.8

Pinging 198.0.0.8 with 32 bytes of data:
Reply from 198.18.1.1: TTL expired in transit.
Reply from 198.18.1.1: TTL expired in transit.
Reply from 198.18.1.1: TTL expired in transit.
Reply from 198.18.1.1: TTL expired in transit.

Ping statistics for 198.0.0.8:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
5
  • 1
    This is incorrect, a router will decrement TTL when the packet exits the router, not when it arrives. If it decremented the TTL on arrival packets with a TTL of 1 would not be able to reach local router interfaces as they would arrive, be decremented to 0 and then be dropped. In reality this is not the case.
    – user27899
    Nov 3, 2017 at 22:00
  • So, you disagree with the RFCs? Those are exact quotes from the RFCs. It may be that some devices are not RFC compliant. Certainly, the host OSes are generally non-compliant. The point of the TTL is to protect the upper-layer protocols from old data, and the host IP module is supposed to decrement the TTL, but none actually do.
    – Ron Maupin
    Nov 3, 2017 at 22:31
  • The TTL is decremented when the packet is routed. A TTL of 1 enables a packet to reach a destination inside a router (eg. loopback), but it will not be forwarded to another network. You can test this with any router that's around.Hosts are usually single-homed, so there'd be no point in discarding a packet that has just barely made it - a router sending out a packet with TTL = 1 could as well just drop it.
    – Zac67
    Nov 4, 2017 at 8:51
  • 1
    @RonMaupin No, I don't disagree with the RFC, but it is open to interpretation. Also, your quote from the IPv6 RFC is from an obsoleted RFC, RFC 8200 is the current standard and that specifically says not to drop a packet destined for the local router. Also, the section from RFC 2460 you posted above is part of a nested if statement the packet must contain routing headers (source routing) to be evaluated by the logic, if the packet definitely has extra hops (due to routing headers) then it does make sense to drop the packet. You can't just post part of the statement as it is out of context.
    – user27899
    Nov 4, 2017 at 11:12
  • 1
    From RFC 8200: Hop Limit: 8-bit unsigned integer. Decremented by 1 by each node that forwards the packet. When forwarding, the packet is discarded if Hop Limit was zero when received or is decremented to zero. A node that is the destination of a packet should not discard a packet with Hop Limit equal to zero; it should process the packet normally.
    – user27899
    Nov 4, 2017 at 11:16
0

Maximus hop counts depend upto routing protocols used in topology for routing traffic ..

  1. EIGRP has a maximum hop count of 224 and a default maximum hop count of 100.

  2. For Routing information protocol (RIP) maximum hop count is 15 .

  3. For OSPF hop count is considered to be unlimited .we feasible to add unlimited hops while building networks with OSPF routing protocol.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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