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

JB wrote:
Frantisek Hanzlik <franta <at>> writes:


Just a wild guess if you want to try.

Turn off ICMP redirect:
# echo "0' > /proc/sys/net/ipv4/conf/all/accept_redirects
# echo "0" > /proc/sys/net/ipv4/conf/all/send_redirects

Flush arp cache:
# ip neigh flush all

Flush the route cache:
# ip route flush cache

Now try *separate* entries:
# ping -n -c 2 -I source_ip target_ip
# ping -n -c 2 -I source_if target_ip


It is the same. My opinion was ping in case of "-I netdev" gets
interface address (when it have only one, as in this case, this should
not be a problem) and things further come in same manner as if I give
"-I IPAddr" But ping behaves somehow else - for exact findings it would
be necessary overview its souce code. Maybe it not specify source IP
address - when I "ping -I eth1 target_ip", then I see at eth1 ARP
requests for target_ip (although it not belong to eth1 network segment).

OTOH: traceroute behaves fine and its syntax is IMO more obvious,
both "traceroute -i eth1 target_ip" and
"traceroute -i source_ip target_ip"
works fine and packets goes thru proper interface. And it can specify
separatelly to which device use and which source address use.

users mailing list
To unsubscribe or change subscription options: