View previous topic :: View next topic |
Author |
Message |
Drakino n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 27 Apr 2004 Posts: 3
|
Posted: Fri Apr 30, 2004 7:23 am Post subject: Multiple ISPs connected to 1 server, how to load balance? |
|
|
Has anyone successfully set up a Gentoo server to have two ISPs connected, and use both, including sharing both to clients on the LAN? I attempted this recently with no luck in getting it 100% working.
I got started by installing Shorewall, and referencing their FAQ on the subject. I built my own configuration script to redo the routes, and had success on the server. But masquarading didn't like the setup, as I saw the following errors in the syslog:
81017-Apr 27 01:59:27 central printk: 7 messages suppressed.
81018:Apr 27 01:59:27 central MASQUERADE: Route sent us somewhere else.
My setup is as follows:
eth0 - Internal LAN, 192.168 setup
eth1 - Cable modem, dhcp assigned IP
eth2 - Wireless provider, static IP
The route script I built follows:
#!/bin/bash
MYIP=$(/sbin/ifconfig | grep -1 eth0 | cut -s -d ' ' -f12 | grep addr |cut -d ':' -f2)
ISP1IP=$(/sbin/ifconfig | grep -1 eth1 | cut -s -d ' ' -f12 | grep addr |cut -d ':' -f2)
ISP2IP=$(/sbin/ifconfig | grep -1 eth2 | cut -s -d ' ' -f12 | grep addr |cut -d ':' -f2)
ISP1GW=$(/sbin/route -vne | grep eth1 | cut -s -d ' ' -f10 | grep .)
ISP2GW=216.XXX.XXX.145
ISP1NET=$(/sbin/route -vne | grep eth1 | cut -s -d ' ' -f1 | grep -v 0.0.0.0)/24
ISP2NET=216.XXX.XXX.144/28
echo "Flushing Route Tables"
/sbin/ip route flush all
/sbin/ip route add $ISP1NET dev eth1 src $ISP1IP table T1
/sbin/ip route add default via $ISP1GW table T1
/sbin/ip route add $ISP2NET dev eth2 src $ISP2IP table T2
/sbin/ip route add default via $ISP2GW table T2
/sbin/ip route add $ISP1NET dev eth1 src $ISP1IP
/sbin/ip route add $ISP2NET dev eth2 src $ISP2IP
/sbin/ip route add 192.168.0.0/24 dev eth0 src 192.168.0.1
/sbin/ip route add default scope global nexthop via $ISP1GW dev eth1 weight 1 nexthop via $ISP2GW dev eth2 weight 1
/sbin/ip rule add from $ISP1IP table T1
/sbin/ip rule add from $ISP2IP table T2
/sbin/ip route add 192.168.0.0/24 dev eth0 table T1
/sbin/ip route add $ISP2NET dev eth2 table T1
/sbin/ip route add 127.0.0.0/8 dev lo table T1
/sbin/ip route add 192.168.0.0/24 dev eth0 table T2
/sbin/ip route add $ISP1NET dev eth1 table T2
/sbin/ip route add 127.0.0.0/8 dev lo table T2
One thing that would help greatly would be to see soneone elses working script, and also a kernel config, as I have a feeling it may be an option buried deep inside 2.6 that I am missing. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
mr-simon Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/9548866923e424191c72bf.gif)
Joined: 22 Nov 2002 Posts: 367 Location: Leamington Spa, Warks, UK
|
Posted: Fri Apr 30, 2004 10:14 am Post subject: |
|
|
I did this when I was switching from ADSL to Cable, and I had both connections in for a couple of months because my contract had still to expire. It took a long time to get working, and it was a while ago when I did it.
Your script looks similar to the stuff I was using... But that was on kernel 2.4, and I know I had to apply several kernel patches to make it work. I'm not sure if this is still nessecary on 2.6, but it might well be. I had the same problem that I figured it should all be working, but it didn't... And then I patched my kernel and it all started.
Have you seen the lartc page on the subjetct? Particularly the linked page with some kernel patches on. You should probably try applying those. _________________ "Pokey, are you drunk on love?"
"Yes. Also whiskey. But mostly love... and whiskey." |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Drakino n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 27 Apr 2004 Posts: 3
|
Posted: Sun May 09, 2004 6:46 pm Post subject: |
|
|
I'll try these kernel patches when I get some time towards the end of the month. Server lost a network card, so I lack enough to do this right now.
Kinda irritating to see the cable modem all powered down now. I was at least using Squid to get the speed from it until that card failed about a day after I posted this. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|