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

Frantisek Hanzlik franta at hanzlici.cz
Thu Sep 29 07:56:04 UTC 2011


Kernel Guardian wrote:
> yes it is always related with routing.
> it would be helpful to see your routing table

I think it is some combination of routing rules and different ping
behavior when with "-I" switch is used interface name or interface IP.
But I have no idea why ping behaves differently.

So there are some clarifications:
- kernel 2.6.35.14-96.fc14.i686.PAE and ping from iputils-20100418

- from ppp0 (other interface to internet) both variants works fine.

- from eth2 (third iface to internet, its private IP is 1:1 NATed
at ISP site to public IP) both "ping -I" variants works when eth2
is (system, in table main) default route.

- when setting eth1 as system default route, situation reversed:
both "ping -I" variants works on eth1, and on eth2 only when its
IP is used with ping -I. Likely expected, as routing tables & rules
are symmetric for both eth1 and eth2.

- from outside (from internet) is possible without problem ping to
all three IPs/FQDNs corresponding with eth1/eth2/ppp0 and connect
to services on this Linux box.

- above behavior is the same independently to whether iptables are
stopped or active.

- ip routing tables and rules (made according to LARTC HOWTO):
# ip rule show
0:	from all lookup local
32763:	from 90.187.57.21 lookup adsl
32764:	from 10.3.60.10 lookup wifibudka
32765:	from 10.128.254.2 lookup wifismrk
32766:	from all lookup main
32767:	from all lookup default

# ip route list
90.187.57.21 dev ppp0  scope link  src 90.187.57.21
78.103.210.66 dev ppp0  proto kernel  scope link  src 90.187.57.21
10.128.254.0/29 dev eth1  proto kernel  scope link  src 10.128.254.2
10.3.60.0/24 dev eth2  proto kernel  scope link  src 10.3.60.10
10.0.1.0/24 dev eth3  proto kernel  scope link  src 10.0.1.254
192.168.0.0/24 dev eth0  proto kernel  scope link  src 192.168.0.254
169.254.0.0/16 dev eth1  scope link  metric 1002
169.254.0.0/16 dev eth2  scope link  metric 1003
169.254.0.0/16 dev eth3  scope link  metric 1004
169.254.0.0/16 dev eth0  scope link  metric 1005
default via 10.3.60.1 dev eth2

# ip route list table wifismrk
90.187.57.21 dev ppp0  scope link
10.128.254.0/29 dev eth1  scope link  src 10.128.254.2
10.3.60.0/24 dev eth2  scope link
192.168.0.0/24 dev eth0  scope link
127.0.0.0/8 dev lo  scope link
default via 10.128.254.1 dev eth1

# ip route list table wifibudka
90.187.57.21 dev ppp0  scope link
10.128.254.0/29 dev eth1  scope link
10.3.60.0/24 dev eth2  scope link  src 10.3.60.10
192.168.0.0/24 dev eth0  scope link
127.0.0.0/8 dev lo  scope link
default via 10.3.60.1 dev eth2

# ip route list table adsl
90.187.57.21 dev ppp0  scope link  src 90.187.57.21
10.128.254.0/29 dev eth1  scope link
10.3.60.0/24 dev eth2  scope link
192.168.0.0/24 dev eth0  scope link
127.0.0.0/8 dev lo  scope link
default dev ppp0  scope link

# 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


Any idea?

Thanks, Franta Hanzlik


More information about the users mailing list