2 adsl connections load balancing with natd/ipfw
Nick Rogness
nick at rogness.net
Mon Jun 7 19:30:26 GMT 2004
On Mon, 7 Jun 2004, gus- wrote:
> doing this with ipfw is trivial:
> isp ip localip local int
> link1: 192.168.1.1 192.168.1.2 em1
> link2: 192.168.2.1 192.168.2.2 em2
>
> route add 0.0.0.0 192.168.1.1
> ipfw add prob 0.5 allow ip from any to any out via em1 fwd 192.168.2.1
>
> however, this would probabaly drop half of your packets if em1 went
> down, should theoreticaly work if em2 drops (because you still have a
> route to 192.168.2.1 via default route)
NAT is involved which puts a wrench in this idea. Keep in mind
that when packets "leave" an interface, their source address(es)
change. So in this case, half the packets would have a source
address of X.X.X.X (leaving interface em1) and the other half
would have Y.Y.Y.Y (leaving interface em2).
The 'only' approach that is realistic (without provider
intervention) is to split traffic based on destination IP as
suggested earlier:
> route add -net 0.0.0.0 -netmask 128.0.0.0 192.168.1.1
> route add -net 128.0.0.0 -netmask 128.0.0.0 192.168.2.1
This splits the IP space exactly in half, sending all traffic
starting with 0->127.X.X.X through em1 and sends all
128->256.X.X.X through em2.
Run 2 instances of natd, one for each interface. You can adjust
your 'load balancing' by using smaller routes and send certain
traffic through different interfaces with route statements.
You would need to monitor load on the interfaces to fine tune this
approach.
--
Nick Rogness <nick at rogness.net>
-
How many people here have telekenetic powers? Raise my hand.
-Emo Philips
More information about the freebsd-isp
mailing list