in reply to ping an IPv4 address, using different gateways

I'm assuming you're on linux. One way is to use raw sockets. Another is to go with policy routing.

The (iputils) ping utility has -m option to mark the packets. So it's just a matter of setting up multiple routing tables with ip rule ... and ip route ....

Google for "policy routing fwmark", "multiple default route", etc.