6

There have been a number of questions about router behaviour with IPv4 packets with TTL=1 and apparently contradictory answers. This question is not about what should a host or router do, it is a practical question about what equipment does in the field.

Question: In IPv4, can we find a models/configuration of Cisco router or other manufacturer where the router discards a TTL=1 packet as expired when the packet has a destination address which is one of the addresses of an interface of that router?

My belief has been that a router will reply identically to packets for any of its IP addresses (ACLs permitting), and so far this has been confirmed by my experiments with the equipment I have easily available. But it is contradicted by Ron Maupin's experiment here https://networkengineering.stackexchange.com/a/45421

  • Behaviour 1 is that end point router decrements TTL to cross from near to far interface
  • Behaviour 2 is that end point router does not decrement TTL to cross from near to far interface

I have only been able to find routers with Behaviour 2.

          MINIMAL                NON-MINIMAL

           =+=               +---R2---R3--...--+
            |Afar            |                 |Anear
            R                R1                Rn
            |Anear           |                 |Afar
    ===+====+====     ===+===+====           ==+==
       |                 |
       H                 H
   Anear = address of interface nearest H
   Afar  = address of interface not nearest H

EXPERIMENT 1: MINIMAL, PACKETS SENT WITH TTL=1

This experiment is intended to be essential identical to Ron Maupin's in his answer https://networkengineering.stackexchange.com/a/45421

We find that packets with TTL=1 reach near and far interfaces.

  • H is Ubuntu 192.168.0.210/24, default route to 192.168.0.1
  • R is Cisco 867VAE with Version 15.2(4)M3 nearside is vlan0 192.168.0.1/24, farside is loopback0=10.0.0.1/24

Ping nearside

$ ping -t 1 -c 1 192.168.0.1
PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.
64 bytes from 192.168.0.1: icmp_seq=1 ttl=255 time=1.72 ms

tcpdump on H shows packets leaving with TTL=1, answers returning

17:43:52.960574 IP (tos 0x0, ttl 1, id 11971, offset 0, flags [DF], proto ICMP (1), length 84)
    192.168.0.210 > 192.168.0.1: ICMP echo request, id 10823, seq 1, length 64
17:43:52.962266 IP (tos 0x0, ttl 255, id 11971, offset 0, flags [DF], proto ICMP (1), length 84)
    192.168.0.1 > 192.168.0.210: ICMP echo reply, id 10823, seq 1, length 64

Ping farside

$ ping -t 1 -c 1 10.0.0.1
PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.
64 bytes from 10.0.0.1: icmp_seq=1 ttl=255 time=1.27 ms

tcpdump on H shows packets with TTL=1 and answers returning

17:44:32.094832 IP (tos 0x0, ttl 1, id 8632, offset 0, flags [DF], proto ICMP (1), length 84)
    192.168.0.210 > 10.0.0.1: ICMP echo request, id 10830, seq 1, length 64
17:44:32.096070 IP (tos 0x0, ttl 255, id 8632, offset 0, flags [DF], proto ICMP (1), length 84)
    10.0.0.1 > 192.168.0.210: ICMP echo reply, id 10830, seq 1, length 64

EXPERIMENT 2: NON-MINIMAL

This is intended to be the same, but the interfaces are all physical and TTL is sent to be just enough to reach the router. We find that TTL=2 fails on near and far interfaces and TTL=3 succeeds on near and far interfaces.

  • H is Ubuntu on 192.168.0.210/24
  • Rn is Cisco 2811 15.1(4)M10 with nearside FastEthernet0/0 on 172.30.20.251/24 and farside FastEthernet0/1 on 172.31.20.254/24

Results are the same for TTL=2 (both fail) and TTL=3 (both succeed) for nearside and farside addresses.

$ ping -t 2 -c 1 172.30.20.251 | fgrep -i From
From 192.168.253.254 icmp_seq=1 Time to live exceeded
$ ping -t 2 -c 1 172.31.20.254 | fgrep -i From
From 192.168.253.254 icmp_seq=1 Time to live exceeded
$ ping -t 3 -c 1 172.30.20.251 | fgrep -i From
64 bytes from 172.30.20.251: icmp_seq=1 ttl=252 time=49.2 ms
$ ping -t 3 -c 1 172.31.20.254 | fgrep -i From
64 bytes from 172.31.20.254: icmp_seq=1 ttl=252 time=49.1 ms

These are the tcpdumps from H:

With TTL=2, packets leave and time exceeded returns

Near

18:31:23.098358 IP (tos 0x0, ttl 2, id 38235, offset 0, flags [DF], proto ICMP (1), length 84)
    192.168.0.210 > 172.30.20.251: ICMP echo request, id 11423, seq 1, length 64
18:31:23.146825 IP (tos 0xc0, ttl 253, id 36603, offset 0, flags [none], proto ICMP (1), length 56)
    192.168.253.254 > 192.168.0.210: ICMP time exceeded in-transit, length 36
    IP (tos 0x0, ttl 1, id 38235, offset 0, flags [DF], proto ICMP (1), length 84)
    192.168.0.210 > 172.30.20.251: ICMP echo request, id 11423, seq 1, length 64

Far

18:31:23.152807 IP (tos 0x0, ttl 2, id 61977, offset 0, flags [DF], proto ICMP (1), length 84)
    192.168.0.210 > 172.31.20.254: ICMP echo request, id 11425, seq 1, length 64
18:31:23.201199 IP (tos 0xc0, ttl 253, id 36606, offset 0, flags [none], proto ICMP (1), length 56)
    192.168.253.254 > 192.168.0.210: ICMP time exceeded in-transit, length 36
    IP (tos 0x0, ttl 1, id 61977, offset 0, flags [DF], proto ICMP (1), length 84)
    192.168.0.210 > 172.31.20.254: ICMP echo request, id 11425, seq 1, length 64

With TTL=3, ICMP echo and response for both nearside and farside addresses

Nearside:

18:31:23.211459 IP (tos 0x0, ttl 3, id 38260, offset 0, flags [DF], proto ICMP (1), length 84)
    192.168.0.210 > 172.30.20.251: ICMP echo request, id 11427, seq 1, length 64
18:31:23.259514 IP (tos 0x0, ttl 252, id 38260, offset 0, flags [DF], proto ICMP (1), length 84)
    172.30.20.251 > 192.168.0.210: ICMP echo reply, id 11427, seq 1, length 64

Farside

18:31:23.268194 IP (tos 0x0, ttl 3, id 61985, offset 0, flags [DF], proto ICMP (1), length 84)
    192.168.0.210 > 172.31.20.254: ICMP echo request, id 11429, seq 1, length 64
18:31:23.316748 IP (tos 0x0, ttl 252, id 61985, offset 0, flags [DF], proto ICMP (1), length 84)
    172.31.20.254 > 192.168.0.210: ICMP echo reply, id 11429, seq 1, length 64
  • Do you expect a list of all possible routers and their behaviors when testing the above? – user36472 Nov 26 '18 at 19:23
  • I was trying to replicate Ron's experiment but couldn't, so I was wondering what was actually different between my experiments and his. So no, just one which behaved differently would be fine :-) – jonathanjo Nov 26 '18 at 19:25
  • 1
    Can do some tests tomorrow – user36472 Nov 26 '18 at 19:26
  • 2
    The essential questions are which of the internal functions require forwarding? and at which exact point is the TTL decremented? Decrement may happen just before moving then packet to the egress queue, so you might be able ping the far side router interface with TTL=1 even though you can't ping beyond the router. – Zac67 Nov 26 '18 at 19:46
  • @Zac67, Cown chatted with a Cisco quote: "When an IP packet is received with a TTL less than or equal to one and is expected to be forwarded by the router, the router is required to drop the packet and reply back to the source with an ICMPv4 Type 11, Code 0 Time Exceeded message." That is certainly what the RFC for IPv6 says, and it has a flowchart saying any packet with a TTL <= 1 should be discarded. I think this whole subject has been variously implemented. Most host OSes do not decrement before passing IPv4 payloads to upper layers as required by RFC 791. – Ron Maupin Nov 26 '18 at 20:27
5

Test procedure with packet capture on router

A router Cisco 867VAE-K9 with 15.2(4)M3 has a number of local interfaces, and a test computer connected on the far side of Virtual-PPP1. We will ping the near interface and two far interfaces, one vlan, one loopback.

We do it across a multi-hop network so that we can see that a change in the TTL of the sent pings results in success or failure of the packets arriving on the router and the ping responses, in order to discount any other configuration issues such as ACLs, routes.

Pings are sent from H to GW and require TTL=3 to arrive. TTL=2 packets do not arrive and are expired by R255 (with ICMP time exceeded messages).

                       R255
                  .255/  \.255
 tunnels in          /    \
 192.168.253/24   .8/      \.0 on Virtual-PPP1
                  R8        GW---| 10.0.0.1 on Loopback0
  192.168.8/24    |.1       |.1 on Vlan1
       ======+====+==     ==+===
             |.192
             H

Interfaces

gw#show ip int b
Interface                  IP-Address      OK? Method Status                Protocol
Loopback0                  10.0.0.1        YES NVRAM  up                    up      
Virtual-PPP1               192.168.253.0   YES IPCP   up                    up      
Vlan1                      192.168.0.1     YES NVRAM  up                    up   

Access list for the packet capture

gw#show access-list 111
Extended IP access list 111
    10 permit ip host 192.168.8.192 any
    20 permit ip any host 192.168.8.192

Packet capture

gw#monitor capture buffer BUF1
gw#monitor capture buffer BUF1 max-size 2000 
gw#monitor capture buffer BUF1 filter access-list 111
Filter Association succeeded
gw#monitor capture point ip process-switched POINT1 both
gw#monitor capture point associate POINT1 BUF1
gw#monitor capture buffer BUF1 clear
gw#monitor capture point start POINT1

On far computer, these all fail (and will not show in the packet capture on gw)

ping -c 1 -t 2 192.168.0.1
ping -c 1 -t 2 10.0.0.1
ping -c 1 -t 2 192.168.253.0

On far computer, these all succeed (and will all show in the packet capture)

ping -c 1 -t 3 192.168.0.1
ping -c 1 -t 3 10.0.0.1
ping -c 1 -t 3 192.168.253.0

Finish capture and export PCAP file

gw#monitor capture point stop POINT1 
gw#monitor capture buffer BUF1 export tftp://192.168.0.32/ping.pcap

Capture shows packets arriving with TTL=1 and responses sent, equally for near and far interfaces.

$ tcpdump -nv -r ping.pcap 
reading from file ping.pcap, link-type RAW (Raw IP)
20:14:18.328670 IP (tos 0x0, ttl 1, id 20579, offset 0, flags [DF], proto ICMP (1), length 84)
    192.168.8.192 > 192.168.0.1: ICMP echo request, id 25603, seq 1, length 64
20:14:18.328670 IP (tos 0x0, ttl 255, id 20579, offset 0, flags [DF], proto ICMP (1), length 84)
    192.168.0.1 > 192.168.8.192: ICMP echo reply, id 25603, seq 1, length 64
20:14:18.556668 IP (tos 0x0, ttl 1, id 46061, offset 0, flags [DF], proto ICMP (1), length 84)
    192.168.8.192 > 10.0.0.1: ICMP echo request, id 25604, seq 1, length 64
20:14:18.556668 IP (tos 0x0, ttl 255, id 46061, offset 0, flags [DF], proto ICMP (1), length 84)
    10.0.0.1 > 192.168.8.192: ICMP echo reply, id 25604, seq 1, length 64
20:14:18.780667 IP (tos 0x0, ttl 1, id 38504, offset 0, flags [DF], proto ICMP (1), length 84)
    192.168.8.192 > 192.168.253.0: ICMP echo request, id 25605, seq 1, length 64
20:14:18.780667 IP (tos 0x0, ttl 255, id 38504, offset 0, flags [DF], proto ICMP (1), length 84)
    192.168.253.0 > 192.168.8.192: ICMP echo reply, id 25605, seq 1, length 64

Conclusion

We see the TTL=1 ECHO REQUEST packets arrive and then the ECHO REPLY packets leave, for near and far interfaces.

Therefore we conclude Cisco routers do not decrement TTL to reach, but not exit, a different interface than the ingress interface of an IPv4 packet.

4

As promised, I can confirm same results as above on the following equipment:

Cisco 6509 with Supervisor 2T running VSS.

cisco WS-C6509-E (M8572) processor (revision 0) with 3162112K/524288K bytes of memory. 
Cisco IOS Software, s2t54 Software (s2t54-ADVENTERPRISEK9-M), Version 15.2(1)SY5, RELEASE SOFTWARE (fc4)

Cisco C9500-16X

Cisco IOS Software [Everest], Catalyst L3 Switch Software (CAT9K_IOSXE), Version 16.6.3, RELEASE SOFTWARE (fc8) 

Cisco 897 Series

Cisco IOS Software, C800 Software (C800-UNIVERSALK9-M), Version 15.4(2)T1, RELEASE SOFTWARE (fc3)

Neither of them decrement TTL when the packet traverse the Router internally between multiple interfaces. When the packet leaves the Router it will be drecremented, when it's added to the egress queue on the output interface.

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.