The following deals with bug in ping that made it very difficult to set up a system with two gateways.  <br><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<br>PING 208.67.222.222 (208.67.222.222) from 4.3.2.8 eth0: 56(84) bytes of data.<br>From 4.3.2.8 icmp_seq=1 Destination Host Unreachable<br>From 4.3.2.8 icmp_seq=2 Destination Host Unreachable<br>
<br>--- 208.67.222.222 ping statistics ---<br>2 packets transmitted, 0 received, +2 errors, 100% packet loss, time 999ms<br>, pipe 2<br></pre>
<br> <b> ping using  4.3.2.8 </b>:
<pre>ping -c 2 -B -I  4.3.2.8 208.67.222.222<br>PING 208.67.222.222 (208.67.222.222) from 4.3.2.8 : 56(84) bytes of data.<br>64 bytes from <a href="http://208.67.222.222/" target="_blank">208.67.222.222</a>: icmp_seq=1 ttl=55 time=562 ms<br>
64 bytes from <a href="http://208.67.222.222/" target="_blank">208.67.222.222</a>: icmp_seq=2 ttl=55 time=642 ms<br><br>--- 208.67.222.222 ping statistics ---<br>2 packets transmitted, 2 received, 0% packet loss, time 999ms<br>
rtt min/avg/max/mdev = 562.546/602.400/642.255/39.862 ms<br></pre>
<br> <b> ping using  eth1 </b>:
<pre>ping -c 2 -B -I  eth1 208.67.222.222<br>PING 208.67.222.222 (208.67.222.222) from 192.168.168.155 eth1: 56(84) bytes of data.<br>64 bytes from <a href="http://208.67.222.222/" target="_blank">208.67.222.222</a>: icmp_seq=1 ttl=54 time=270 ms<br>
64 bytes from <a href="http://208.67.222.222/" target="_blank">208.67.222.222</a>: icmp_seq=2 ttl=54 time=629 ms<br><br>--- 208.67.222.222 ping statistics ---<br>2 packets transmitted, 2 received, 0% packet loss, time 1000ms<br>
rtt min/avg/max/mdev = 270.128/449.766/629.405/179.639 ms<br></pre>
<br> <b> ping using  192.168.168.155 </b>:
<pre>ping -c 2 -B -I  192.168.168.155 208.67.222.222<br>PING 208.67.222.222 (208.67.222.222) from 192.168.168.155 : 56(84) bytes of data.<br>64 bytes from <a href="http://208.67.222.222/" target="_blank">208.67.222.222</a>: icmp_seq=1 ttl=54 time=585 ms<br>
64 bytes from <a href="http://208.67.222.222/" target="_blank">208.67.222.222</a>: icmp_seq=2 ttl=54 time=554 ms<br><br>--- 208.67.222.222 ping statistics ---<br>2 packets transmitted, 2 received, 0% packet loss, time 999ms<br>
rtt min/avg/max/mdev = 554.098/569.655/585.212/15.557 ms<br></pre>
<h3>My source route policy rules:</h3>
<pre>/sbin/ip rule show<br>0:       from all lookup 255 <br>32762:    from 4.3.2.8 lookup nic0 <br>32763:       from 192.168.168.155 lookup nic1 <br>32764:       from 192.168.168.155 lookup nic1 <br>32765:       from 4.3.2.8 lookup nic0 <br>32766:       from all lookup main <br>
32767:  from all lookup default <br></pre>
<pre> <br><br>Print out routing tables using /sbin/ip route show table TABLENAME:<br>routing table  nic0 :<br>/sbin/ip route show table nic0<br>default via 4.3.2.1 dev eth0 <br><br>routing table  nic1 :<br>/sbin/ip route show table nic1<br>
default via 192.168.168.1 dev eth1 <br><br>routing table  main :<br>/sbin/ip route show table main<br><a href="http://4.3.2.1/27" target="_blank">4.3.2.1/27</a> dev eth0  proto kernel  scope link  src 4.3.2.8 <br><a href="http://192.168.168.0/24" target="_blank">192.168.168.0/24</a> dev eth1  proto kernel  scope link  src 192.168.168.155 <br>
<a href="http://169.254.0.0/16" target="_blank">169.254.0.0/16</a> dev eth1  scope link <br>default via 192.168.168.1 dev eth1 <br><br>routing table  default :<br>/sbin/ip route show table default<br><br></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/" target="_blank"> http://www.skbuff.net/iputils/ </a> <br>
Mailing List <a href="mailto:netdev@vger.kernel.org" target="_blank">netdev@vger.kernel.org</a> <br>
<pre>man ping:<br>   -I interface address<br>        Set source address to specified interface address. <br>        Argument may be <b>numeric IP address or name of device</b>.<br>        When  pinging  IPv6  link-local  address  this option is required. <br>
</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><div class="gmail_quote"><br><br></div><br><input id="gwProxy" type="hidden"><input onclick="jsCall();" id="jsProxy" type="hidden"><div id="refHTML"></div>