Mini Mini Howto

From LVSKB
Revision as of 14:09, 22 May 2007 by Wensong (Talk | contribs)

Jump to: navigation, search

Mini-Mini-Howto

This describes a quick way to get up and going with LVS.

Instructions

Start from a precompiled Linux distribution. I was using a combination of Fedora Core 4 and Fedora Core 6, but this should work with any recent version of Linux.

The following will set up the real servers to accept data from the load balancer. I put it into a shell script and added that script to /etc/rc.d/rc.local.

echo 1 > /proc/sys/net/ipv4/conf/eth0/arp_ignore
echo 2 > /proc/sys/net/ipv4/conf/eth0/arp_announce
echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore
echo 2 > /proc/sys/net/ipv4/conf/all/arp_announce

ifconfig lo:0 192.168.1.10 netmask 255.255.255.255 broadcast 192.168.1.10 up

One time setup on the load balancer:

rpm -U /net/shauna/usr/local/share/RPMS/4/ipvsadm-1.24-7.x86_64.rpm

I put the following script on the load balancer, again referenced in /etc/rc.d/rc.local

ipvsadm --clear
ipvsadm --add-service --tcp-service 192.168.1.10:80 --scheduler rr
ipvsadm --add-server --tcp-service 192.168.1.10:80 --real-server bart:80 --gatewaying
ipvsadm --add-server --tcp-service 192.168.1.10:80 --real-server lisa:80 --gatewaying

That’s all it took. I didn’t recompile anything. My firewall treats 192.168.1.10, the VIP, just like an ordinary machine. Inside the firewall I have a standard switch. Aside from the firewall, all of the machines are using only one NIC and one subnet.

Rationale

Several years ago I set up an LVS. Recently I did it again. Because of changes in the 2.6 kernel, it was a whole lot easier this time. It was almost trivial. Unfortunately, it took me a long time to dig through the documentation to what I needed.

All of this information was available on Google, but it was hiding. I can appreciate the older documentation – as I said I worked with this software a long time ago – but some of it has little or no value. How many people, for example, need to use an old version of the kernel? There may be a place for that information, but it should not be the first thing that a potential user sees.