Cisco – Pinging a host from a router through the selected interface

ciscopingrouter

In a typical Cisco router it's possible to ping a host from the router's OS. When the ping packet leaves router (call it R1) through the fa0/0 interface, the source IP of that packet it set to the IP of fa0/0, right?

Is it possible to specify the interface of R1 I want the ping packet to go through? Different interfaces = different source IPs.

I know that usually there's only one way to the destination, but still. I'm not even sure if it's possible, because we would need to somehow make the router ignore its routing table – simply because the routing table gives a router exact information where to send the packet to, there can't be two 'matching' entries with identical priority in the table.

Best Answer

You can set the source of the ping, but the direction is determined by the routing table and rules configured in the router.

You can use PBR to override the routing table, but that does affect the routing speed since it must be done in software. Also, it doesn't scale, and you can end up with routing loops.