Results 1 to 3 of 3
Hello Everyone,
I am trying to setup a Load Balance and Fail over running on CentOS (CentOS release 5.7 (Final)).
Here's my setup.
eth0 - ISP 1 - 4M Leased ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 06-05-2012 #1Just Joined!
- Join Date
- Jan 2011
- Posts
- 44
Load Balance and Fail Over on CentOS
Hello Everyone,
I am trying to setup a Load Balance and Fail over running on CentOS (CentOS release 5.7 (Final)).
Here's my setup.
eth0 - ISP 1 - 4M Leased Line 58.71.20.34 /28
eth1 - ISP 2 - 4M Leased Line 121.10.60.82 /28
eth2 - LAN : 192.168.1.x
I am following this guide Dual WAN Configuration with Linux
Here's my current routing table (route -n)
58.71.20.32/28 dev eth0 proto kernel scope link src 58.71.20.34
121.10.60.81/28 dev eth1 proto kernel scope link src 121.10.60.83
192.168.1.0/24 dev eth2 proto kernel scope link src 192.168.1.1
169.254.0.0/16 dev eth2 scope link
default via 121.10.60.82 dev eth1
When I tried to type below. no error but when I check route -n, still the same output.
#ip route add 58.71.20.32/28 dev eth0 src 58.71.20.34 table IGT
#ip route add default via 58.71.20.33 table IGT
#ip route add 121.10.60.81/28 dev eth1 src 121.10.60.83 table BTEL
#ip route add default via 121.10.60.82 table BTEL
#ip rule add from 58.71.20.34 table IGATE
#ip rule add from 121.10.60.83 table BTEL
When I type this, I got error
#ip route add default scope global nexthop via 58.71.20.33 dev eth0 weight 1 nexthop via 121.10.60.82 dev eth1 weight 1
it says "RTNETLINK answers: File exists"
Also, I cannot use my other line which is the 58.71.x.x segment when the other line is plugin and configure, maybe the system is using default gateway 121.10.60.82. So when the 121.10.x.x is down, I got no internet access.
1. How can I add default gateway for both ISP, 58.x.x.x and 121.x.x.x ? so when 1 link is down, another link will take over.
2. I am currently, using transparent proxy to share my internet, how can I configure the iptables to use both with load balance.
3. I am also using SQuid Proxy, but not sure how to configure to work on this setup (dual wan/ load balacer / fail over)
Hope you can help me with this setup.
Sincerely,
Wizzkid.
- 06-06-2012 #2Just Joined!
- Join Date
- Jan 2011
- Posts
- 44
Hi,
I've successfully implement this, by following Routing for multiple uplinks/providers
CentOS Linux 5.7
Squid version 2.6
Interfaces:
eth0 = WAN
eth1 = WAN
eth2 = LAN
When I use it without squid proxy, it works perfectly, I tried to take down one ISP and another using ifdown anf ifup command, and fail over is working.
Now when I use SQUID Proxy, only eth0 is working., so when eth0 is down, I had to adjust the iptables to comment the line with ip 58.71.xx.xx and eth0.Code:iptables -A INPUT -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT iptables -A INPUT -i eth1 -m state --state ESTABLISHED,RELATED -j ACCEPT iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE iptables --table nat --append POSTROUTING --out-interface eth1 -j MASQUERADE iptables --append FORWARD --in-interface eth2 -j ACCEPT
service iptables save. and it works.
Which means, when using squid proxy, when eth0 is down eth1 will not take over unless I re-configure the iptables.
On my squid.conf.
http_port 3128 traparent
Is there anything we can do to fix this on squid? I also want Load Balance and Fail over work on squid proxy.Code:DNAT port 80 request comming from LAN systems to squid 3128 ($SQUID_PORT) iptables -t nat -A PREROUTING -i eth2 -p tcp --dport 80 -j DNAT --to 58.71.xx.xx:3128 iptables -t nat -A PREROUTING -i eth2 -p tcp --dport 80 -j DNAT --to 202.78.xx.xx:3128 iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128 iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j REDIRECT --to-port 3128
Sincerely, WizzKid
- 09-25-2012 #3Just Joined!
- Join Date
- Sep 2012
- Posts
- 1
I´m having the SAME issue, have you fixed the problems to work with SQUID? i´m using Squind and MSN-Proxy.


Reply With Quote
