././ping-bug-demo.sh.html
<HTML><HEAD><TITLE>ping -I is broken</TITLE></HEAD> <br>
<BODY> <br>
<h1>ping -I is broken</h1> <br>
<br>
Demonstration that <b>ping -I is broken</b>.  When specifying the source <br>
interface using -I with an <b>ethX</b> alias and that interface is not the default gateway <br>
interface, then ping fails.  When specifying the interface as an ip address, <br>
ping works.  Search for "Destination Host Unreachable" to find the bug. <br>
<br>
<br>
eth<u>0</u> = 4.3.2.8 and the default gateway is accessed through a different interface eth<u>1</u>. <br>
eth<u>1</u> = 192.168.168.155 is used as the device to get to the default gateway. <br>
<b>FAILS </b>: ping <b>-I eth0</b> 208.67.222.222 <br>
<b>WORKS</b>: ping <b>-I 4.3.2.8</b> 208.67.222.222 <br>
<b>WORKS</b>: ping <b>-I eth1</b> 208.67.222.222 <br>
<b>WORKS</b>: ping <b>-I 192.168.168.155</b> 208.67.222.222 <br>
<br>
The following are actual results which can be reproduced from an up-to-date <br>
Fedora 11 or CentOS 5.3 box.  Caused a very very long episode of frustration <br>
when setting up multi gatewayed systems. <br><br>
<br> <b> ping using  eth0 </b>:
<PRE>ping -c 2 -B -I  eth0 208.67.222.222
PING 208.67.222.222 (208.67.222.222) from 4.3.2.8 eth0: 56(84) bytes of data.
From 4.3.2.8 icmp_seq=1 Destination Host Unreachable
From 4.3.2.8 icmp_seq=2 Destination Host Unreachable

--- 208.67.222.222 ping statistics ---
2 packets transmitted, 0 received, +2 errors, 100% packet loss, time 999ms
, pipe 2
</PRE>
<br> <b> ping using  4.3.2.8 </b>:
<PRE>ping -c 2 -B -I  4.3.2.8 208.67.222.222
PING 208.67.222.222 (208.67.222.222) from 4.3.2.8 : 56(84) bytes of data.
64 bytes from 208.67.222.222: icmp_seq=1 ttl=55 time=562 ms
64 bytes from 208.67.222.222: icmp_seq=2 ttl=55 time=642 ms

--- 208.67.222.222 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 562.546/602.400/642.255/39.862 ms
</PRE>
<br> <b> ping using  eth1 </b>:
<PRE>ping -c 2 -B -I  eth1 208.67.222.222
PING 208.67.222.222 (208.67.222.222) from 192.168.168.155 eth1: 56(84) bytes of data.
64 bytes from 208.67.222.222: icmp_seq=1 ttl=54 time=270 ms
64 bytes from 208.67.222.222: icmp_seq=2 ttl=54 time=629 ms

--- 208.67.222.222 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 270.128/449.766/629.405/179.639 ms
</PRE>
<br> <b> ping using  192.168.168.155 </b>:
<PRE>ping -c 2 -B -I  192.168.168.155 208.67.222.222
PING 208.67.222.222 (208.67.222.222) from 192.168.168.155 : 56(84) bytes of data.
64 bytes from 208.67.222.222: icmp_seq=1 ttl=54 time=585 ms
64 bytes from 208.67.222.222: icmp_seq=2 ttl=54 time=554 ms

--- 208.67.222.222 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 554.098/569.655/585.212/15.557 ms
</PRE>
<h3>My source route policy rules:</h3>
<PRE>
/sbin/ip rule show
0:      from all lookup 255 
32762:  from 4.3.2.8 lookup nic0 
32763:  from 192.168.168.155 lookup nic1 
32764:  from 192.168.168.155 lookup nic1 
32765:  from 4.3.2.8 lookup nic0 
32766:  from all lookup main 
32767:  from all lookup default 
</PRE>
<PRE> <br>
Print out routing tables using /sbin/ip route show table TABLENAME:
routing table  nic0 :
/sbin/ip route show table nic0
default via 4.3.2.1 dev eth0 

routing table  nic1 :
/sbin/ip route show table nic1
default via 192.168.168.1 dev eth1 

routing table  main :
/sbin/ip route show table main
4.3.2.1/27 dev eth0  proto kernel  scope link  src 4.3.2.8 
192.168.168.0/24 dev eth1  proto kernel  scope link  src 192.168.168.155 
169.254.0.0/16 dev eth1  scope link 
default via 192.168.168.1 dev eth1 

routing table  default :
/sbin/ip route show table default

</PRE> <br>
<br>
<br>
NOTES:
cat /etc/iproute2/rt_tables to get your own table names. <br>
<br>
ping Maintainer YOSHIFUJI Hideaki / USAGI/WIDE Project <br>
<a href="http://www.skbuff.net/iputils/"> http://www.skbuff.net/iputils/ </a> <br>
Mailing List netdev@vger.kernel.org <br>
<PRE>
man ping:
   -I interface address
        Set source address to specified interface address. 
        Argument may be <b>numeric IP address or name of device</b>.
        When  pinging  IPv6  link-local  address  this option is required. 
</PRE>
ping -V returns the latest available on CentOS and Fedora and the maintainers website: <br>
<CODE> <br>
ping utility, iputils-ss020927
</CODE> <br>
<br>
<br>
</BODY></HTML>