[CentOS] How to access the internet from load-balanced nodes?

Tom Brown

tom at ng23.net
Tue Jan 30 10:40:44 UTC 2007


> Now I need to know how give working nodes ability to access the 
> internet? I ask this because I don't know how to write properly iptables 
> rules so LVS balancing packets will not conflict with working nodes 
> internet connections. Should I assign some IP-alias for default gateway 
> for that nodes or something else?

make sure you can route the outbound traffic through the lvs cluster and 
then nat it to the external pool IP of that cluster

echo 1 > /proc/sys/net/ipv4/ip_forward

iptables -t nat -A POSTROUTING -s some_internal_IP -o eth0 -j SNAT 
--to-source the_public_cluster_IP

you can add as many of the second lines as you see fit depending on how 
many internal boxes you have.

Also remember that the default route for the internal boxes should be an 
IP that is floating so that in the event of one of your LVS's crashing 
you can still route outbound.

Hope that helps



More information about the CentOS mailing list