Ping using specific gateway interface or source IP address

Originally published at: https://www.cyberciti.biz/faq/ping-using-specific-gateway-interface-or-source-ip-address/

[iocn type=“networking”]I have multiple gateways configured on my Linux or Unix based router. How do I ping through a specific interface of the gateway? How can I ping using a particular source IP address?