Ping using specific gateway interface or source IP address

To ping using a specific gateway interface or source IP address, you can use the “-I” or “-S” option with the “ping” command. The “-I” option specifies the network interface to use for the ping request, while the “-S” option specifies the source IP address to use. For example, the following command pings google.com using the eth0 interface and a source IP address of 10.0.0.1:

ping -I eth0 -S 10.0.0.1 google.com

It is important to note that the -S option only works with superuser privileges.

Leave a Comment