Difference between revisions of "Mini Mini Howto"

From LVSKB
Jump to: navigation, search
(Instructions)
m (Mini-Mini-Howto)
Line 1: Line 1:
 
== Mini-Mini-Howto ==
 
== Mini-Mini-Howto ==
  
This describes a quick way to get up and going with LVS.
+
This howto describes a quick way to get up and going with LVS.
  
 
== Instructions ==
 
== Instructions ==

Revision as of 05:24, 11 November 2007

Mini-Mini-Howto

This howto 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 (192.168.1.100 and 192.168.1.101) to accept data from the load balancer (192.168.1.5) for VIP 192.168.1.10. I put it into a shell script and added that script to /etc/rc.d/rc.local on real servers.

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

ifconfig eth0:0 192.168.1.10 netmask 255.255.255.255 broadcast 192.168.1.10 up
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 192.168.1.100:80 --gatewaying
ipvsadm --add-server --tcp-service 192.168.1.10:80 --real-server 192.168.1.101: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.