0

There is a device, let's call it 1, on network A

Device 1 has two interfaces, eth5 and eth7

There is a device 2 on network A

Pinging from eth5 to device 2 works

Pinging from eth7 to device 2 works

Device 2 can ping eth5 and eth7

BUT, pinging from eth5 to eth7 and vice versa does not work..

[root@ipfrmk /]# ping -I eth5 192.168.10.42
PING 192.168.10.42 (192.168.10.42) from 192.168.10.43 eth5: 56(84) bytes of data.
^C
--- 192.168.10.42 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2006ms

and

[root@ipfrmk /]# ping -I eth7 192.168.10.43
PING 192.168.10.43 (192.168.10.43) from 192.168.10.42 eth7: 56(84) bytes of data.
^C
--- 192.168.10.43 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 1999ms

Why can't I ping between the two interfaces that are both on device 1 which are both connected to network A?

I can ping other devices on network A but I can't ping the interfaces respectively.

Perhaps a static route for each interface?

I tried the following command with no luck..

ip route add 192.168.0.0/16 via 192.168.10.42 dev eth5

Output

[root@ipfrmk /]# ping -I eth5 192.168.10.42
PING 192.168.10.42 (192.168.10.42) from 192.168.10.43 eth5: 56(84) bytes of data.
From 192.168.10.43 icmp_seq=1 Destination Host Unreachable
From 192.168.10.43 icmp_seq=2 Destination Host Unreachable
From 192.168.10.43 icmp_seq=3 Destination Host Unreachable
^C
--- 192.168.10.42 ping statistics ---
6 packets transmitted, 0 received, +3 errors, 100% packet loss, time 5002ms
pipe 3

There has to be something I am missing?

[root@ipfrmk /]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 eth5
192.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 eth7
192.168.0.0     192.168.10.42   255.255.0.0     UG    0      0        0 eth5
RAZ_Muh_Taz
  • 115
  • 2
  • 8

2 Answers2

1

In this situation, I recommend using the IP address bound the interface you want to send from, rather than the interface itself (for your config).

ping -I <ens5 IP address> <ens7 IP address>

The reason the ping isn't working as expected, is that the resultant IPv4 datagram's destination IP address is that of the interface passed to ping, rather than the given target IP address.

My config:

2: ens5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
     link/ether 52:54:00:e0:cc:50 brd ff:ff:ff:ff:ff:ff
     inet 192.168.122.10/24 brd 192.168.122.255 scope global ens5

3: ens6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 
     link/ether 52:54:00:cd:c9:91 brd ff:ff:ff:ff:ff:ff
     inet 192.168.122.20/24 brd 192.168.122.255 scope global ens6
        
     

This looks like it should work, but doesn't:

root@debian:/home/morgan# ping -c 1 -I ens5 192.168.122.20
PING 192.168.122.20 (192.168.122.20) from 192.168.122.10 ens5: 56(84) bytes of data.

--- 192.168.122.20 ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 1ms

tcpdump output shows why it isn't working....

The destination IP address is that of the ens5 interface, rather than the expected target IP (192.168.122.20) passed to ping.

18:36:17.982917 IP 192.168.122.10 > 192.168.122.10: ICMP host 192.168.122.20 unreachable, length 92

When I use the IP address of ens5, the ping works:

root@debian:/home/morgan# ping -c 1 -I 192.168.122.10 192.168.122.20                                                                                                   
PING 192.168.122.20 (192.168.122.20) from 192.168.122.10 : 56(84) bytes of data.                                                                                       
64 bytes from 192.168.122.20: icmp_seq=1 ttl=64 time=5.17 ms                                                                                                           
                                                                                                                                                                   
--- 192.168.122.20 ping statistics ---                                                                                                                                 
1 packets transmitted, 1 received, 0% packet loss, time 2ms                                                                                                            
rtt min/avg/max/mdev = 5.165/5.165/5.165/0.000 ms                                                                                                                      
Morgan
  • 371
  • 1
  • 3
0

I could be wrong... But is this a hairpin turn? It may not be able to reach back to itself in that manner. Sometimes it can't go out and back in the same interface like that.