[CentOS] two internet connections questions

Ken Price kprice at nowyouknow.net
Wed Oct 10 15:31:45 UTC 2007


>
> In the event that the internet connection is DOWN (box is fine just the
> cable modem is down)
> how do I set things up so I can take advantage of the second internet
> connection?

there are more ideal [and complex] ways of setting up the connections  
so you only use one firewall - maybe using the second as a failover -  
but assuming you want to keep your infrastructure the same:

create a second routing table one the cable modem firewall, with a  
default route of the other firewall.

(assuming the other firewall is 10.10.10.2 and the internal NIC is eth1)

# echo 2 >> /etc/iproute2/rt_tables
# ip rule add fwmark 3 table 2
# ip route add default via 10.10.10.2 dev eth1 table 2

write a simple bash script that pings the cable modem's gateway.  on  
failure, after a predetermined amount of time, add an "iptables" rule  
such as the following to use the second routing table:

(assuming 10.10.10.0/24 is your internal LAN)
# iptables -t mangle -A PREROUTING -s 10.10.10.0/24 -j MARK --set-mark 3

You can extend your BASH script to remove the IPTABLES rule once it  
re-establishes contact with your cable modem's gateway.

it's not an elegant solution, but it's a simple one.

-ken

>
> Thanks for any tips.
>
> Jerry






More information about the CentOS mailing list