Thread: ping question
View Single Post
  #7   (View Single Post)  
Old 10th November 2011
denta denta is offline
Shell Scout
 
Join Date: Nov 2009
Location: Sweden
Posts: 95
Default

OpenBSD has an awesome feature called routing domains that might be usable in your scenario.

Lets say you wish to send pings through interface if_2 (which has ip address a.b.c.d), while your default route is through interface if_1. Try the following:

Code:
# ifconfig if_2 rdomain 1
# route -T 1 add 0.0.0.0/0 a.b.c.d
This adds if_2 to routing table 1 (0 is default), and adds a default route through the if_2 interface for the new rdomain. The ip address might need to be set again for the interface if_2 after the first command.

Now, to use the new routing domain:

Code:
# route -T 1 exec ping <whatever host you needed to ping>
Packets will exit through interface if_2.

Last edited by denta; 10th November 2011 at 09:23 PM.
Reply With Quote