I have such a topology made of network namespaces and veth pairs:
------ ------ ------
| a1 | | r1 | | r2 |
| | a1-eth0-----------r1-eth0 | |r1-eth1--------------r2-eth1| |
-----(11.0.0.1/30) (11.0.0.2/30)----(11.0.0.9/30) (11.0.0.10/30)-----
For r1, net.ipv4.ip_forward is 1.
I can successfully ping r2 by a1 with the command:
ping -I a1-eth0 -c1 11.0.0.10
Also, I can successfully ping r2 by r1 using r1-eth1 interface with the command:
ping -I r1-eth1 -c1 11.0.0.10
But then, why can't I ping r2 by r1 using r1-eth0 interface? I get Destination Host Unreachable:
ping -I r1-eth0 -c1 11.0.0.10
PING 11.0.0.10 (11.0.0.10) from 11.0.0.2 r1-eth0: 56(84) bytes of data.
From 11.0.0.2 icmp_seq=1 Destination Host Unreachable
--- 11.0.0.10 ping statistics ---
1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms
The same way, I cannot ping one interface of router r1 by another interface of this very router:
# here I get Destination Host Unreachable again:
ping -I r1-eth0 -c1 11.0.0.9
# here I get Redirect Host(New nexthop: 11.0.0.9):
ping -I r1-eth1 -c1 11.0.0.2
Here is the main route table of r1:
ip route
default via 11.0.0.10 dev r1-eth1
11.0.0.0/30 dev r1-eth0 proto kernel scope link src 11.0.0.2
11.0.0.8/30 dev r1-eth1 proto kernel scope link src 11.0.0.9
So to me it looks like the problem is that interfaces of the router r1 cannot communicate between each other. However, r1 forwards traffic between a1 and r2 normally.
Thank you for attention!
UPDATE:
I needed to solve the problem discussed above to solve the problem Tc qdisc delay not seen in tcpdump recording. I have found the solution to that problem and I posted there by the link. So I do not need this question anymore and I close it. Thank you everybody for reading and participating!