Archive

Archive for December, 2009

PF: Load Balancing

December 11, 2009 Leave a comment

The following example balances outgoing traffic across two Internet

connections:

lan_net = “192.168.0.0/24”
int_if  = “dc0”
ext_if1 = “fxp0”
ext_if2 = “fxp1”
ext_gw1 = “68.146.224.1”
ext_gw2 = “142.59.76.1”

pass in on $int_if route-to
{ ($ext_if1 $ext_gw1), ($ext_if2 $ext_gw2) } round-robin
from $lan_net to any keep state

The route-to option is used on traffic coming in on the
internal interface to specify the outgoing network interfaces
that traffic will be balanced across along with their respective
gateways. Note that the route-to option must be present on
each filter rule that traffic is to be balanced for. Return
packets will be routed back to the same external interface that they
exited (this is done by the ISPs) and will be routed back to the
internal network normally.

Read more…

Categories: FreeBSD
%d bloggers like this: