[KLUG Members] load balancing router

Adam Tauno Williams members@kalamazoolinux.org
Thu, 01 Nov 2001 11:20:14 -0500 (EST)


>>Are the cable modems plugged directly (via cross-cable) to NICs in
>>hosts or into a hub/switch?  If the modems are plugged into a switch does 
>>the switch support VLAN?
>The modems are connected directly in to the Nic via streight through
>cables so no hubs or switches.
>I was thinking I would throw a third ethernet card in to the box adjust
>from there.  Is that the right path to explor or is there a "better" way of
>doing it.

That is the easiest way.  You'll need to be running a 2.4.x kernel.


Assuming eth0/IP1 = your internal interface and eth1/IP2, eth2/IP3 = your cable
modems.

iptables -t nat -A POSTROUTING -s {IP1/MASK} -o eth1 -j SNAT --to {IP2}
iptables -t nat -A POSTROUTING -s {IP1/MASK} -o eth2 -j SNAT --to {IP3}
iptables -A FORWARD -i eth1 -m state --state NEW,INVALID -j DROP
iptables -A FORWARD -i eth2 -m state --state NEW,INVALID -j DROP
ip route add default scope global equalize \
     nexthop via {IP2} dev eth1 \
     nexthop via {IP3} dev eth2

The ideal way would be to bond (EQL) the ethernet interfaces,  but then your
provider would need to support that on their end (doubtful).  Multipath routing
(as described above) is probably the next best thing.  The problem you will
encounter is that one connection cannot be broken over two interfaces (since
they have seperate IPs) so you get sort-of load balanacing much like load
balanceing between two web servers using DNS round-robin.

Systems and Network Administrator
Morrison Industries
1825 Monroe Ave NW
Grand Rapids, MI. 49505