I have a router (running Linux) that is connected to two ISPs, the routes are selected using BGP, however, I would like to ping/trace each connection separately.
The standard traceroute command seems to be able to do it (allow selection of outgoing interface, source IP), but it does not allow selection of the gateway. While there is a command line option (-g), all it does is set the IP routing option instead of just sending the packet there.
Here’s what I want:
Let’s say My router has two IPs – 10.0.0.1 (given by first ISP), 10.1.0.1 (given by second ISP). The default gateway (next hop) on the first ISP is 10.0.0.254 and on the second is 10.1.0.254. One of them is selected as the current default gateway (by BGP), but I also want to be able to use trace/ping trough the other gateway. I cannot change the routing table (without causing connection interruptions, especially if the other ISP has a problem).
traceroute_oth –nexthop 10.0.0.254 220.127.116.11 should give
1 10.0.0.254 2 some-iother-ip.first-isp.com ... x 18.104.22.168
traceroute_oth –nexthop 10.1.0.254 22.214.171.124 should give
1 10.1.0.254 2 some-ip.second-isp.com ... x 126.96.36.199
You did read the man page, right?
-i interface, --interface=interface Specifies the interface through which traceroute should send packets. By default, the interface is selected according to the routing table.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.