Multi-homed FreeBSD system default gateway question

Hi Forum,

I've got a FreeBSD 9.1 system that is attached to two separate /29's connected to different ISPs. Lets call them NET1/29 and NET2/29.

The system does NAT (via pf) for my private IP space behind this system. What I would love to happen is have the system select the default gateway based on the source IP address. Effectively something like this:

If the source IP address is in the range of NET1/29, use the default gateway on NET1 attached to interface em0.
If the source IP address is in the range of NET2/29, use the default gateway on NET2, attached to interface em1.

Right now the system has one default gateway, the gateway on NET1, so if you reach it via its IP address on NET2, the traffic returns to you via the network on NET1, not the network on NET2. If NET1 goes down, I'd love to be able to reach the system via ssh so I can fail over the internet connection.

Is this possible? Thanks!
 
Look at the route-to directive in pf.conf(5). That will route traffic to the selected gateway for matching traffic. Note that you can only re-route incoming (as seen from the point of a network interface) traffic, the directive has no effect on outgoing traffic.
 
Back
Top