How to Ping explicitly from eth1 instead of eth0
I'm trying to execute a ping with eth1, but the program uses eth0(the default network device). Any tips, tricks, or alternate techniques available?
From the manual:
-I interface interface is either an address, or an interface name. If interface is an address, it sets source address to specified interface address. If interface in an interface name, it sets source inter‐ face to specified interface. For ping6, when doing ping to a link-local scope address, link specification (by the '%'-notation in destination, or by this option) is required.
So, answer is:
ping -I eth1 123.123.123.123
Use the -I
option -
-I interface address
Set source address to specified interface address. Argument may
be numeric IP address or name of device. When pinging IPv6 link-
local address this option is required.
ping -I eth1 www.google.com