Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Jun 2004 13:24:29 -0600 (MDT)
From:      Nick Rogness <nick@rogness.net>
To:        gus- <gus@pbx.org>
Cc:        'Joe Hamelin' <joe@nethead.com>
Subject:   Re: 2 adsl connections load balancing with natd/ipfw
Message-ID:  <Pine.LNX.4.44.0406071306060.21475-100000@skywalker.rogness.net>
In-Reply-To: <20040607042216.GA86305@pbx.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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@rogness.net>
-
  How many people here have telekenetic powers? Raise my hand.
  				-Emo Philips
 




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.44.0406071306060.21475-100000>