difference between "ping -I INTERFACE" and "ping -I IPADDRESS" ?

Frantisek Hanzlik franta at hanzlici.cz
Wed Sep 28 12:30:15 UTC 2011


(sorry if this mail arrive in this list once more, I sent it
by mistake cca 90 minutes ago from unregistered e/mail address)

hello Fedora networking gurus,

I always thought that using ping with specifying source interface is
exact equivalent as specifying its IP address - but it is evidently
not true. What I'm getting on my Linux Fedora 14 i686 box:

# ping -I 10.128.254.2 -c 3 -nn 90.183.38.60; echo -e '\n\n';\
>  ping -I eth1 -c 3 -nn 90.183.38.60
PING 90.183.38.60 (90.183.38.60) from 10.128.254.2 : 56(84) bytes of data.
64 bytes from 90.183.38.60: icmp_req=1 ttl=56 time=4.66 ms
64 bytes from 90.183.38.60: icmp_req=2 ttl=56 time=12.7 ms
64 bytes from 90.183.38.60: icmp_req=3 ttl=56 time=4.50 ms

--- 90.183.38.60 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 4.502/7.310/12.769/3.861 ms



PING 90.183.38.60 (90.183.38.60) from 10.128.254.2 eth1: 56(84) bytes of data.
>From 10.128.254.2 icmp_seq=1 Destination Host Unreachable
>From 10.128.254.2 icmp_seq=2 Destination Host Unreachable
>From 10.128.254.2 icmp_seq=3 Destination Host Unreachable

--- 90.183.38.60 ping statistics ---
3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 1999ms
pipe 3


Interface eth1 has IP address 10.128.254.2 :
# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
2: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
    link/ether 00:30:4f:39:4b:49 brd ff:ff:ff:ff:ff:ff
    inet 10.128.254.2/29 brd 10.128.254.7 scope global eth1
3: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:08:c7:25:c7:53 brd ff:ff:ff:ff:ff:ff
    inet 10.3.60.10/24 brd 10.3.60.255 scope global eth2
4: eth3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:08:c7:19:3b:94 brd ff:ff:ff:ff:ff:ff
    inet 10.0.1.254/24 brd 10.0.1.255 scope global eth3
5: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:1e:8c:94:05:cd brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.254/24 brd 192.168.0.255 scope global eth0
6: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1492 qdisc pfifo_fast state UNKNOWN qlen 3
    link/ppp
    inet 90.187.57.21 peer 78.103.210.66/32 scope global ppp0


At all interfaces are only IPv4 addresses, they have not any IP aliases,
iptables are stopped. eth1 is NATed 1:1 to public IP at ISP site.
Know anyone why ping (from iputils-20100418-3.fc14.i686 package)
behaves in such way? May this be somehow related with system routin tables?

Thanks, Franta


More information about the users mailing list