Linux Virtual Server (LVS)

I have a requirement to setup a Linux load balancer on one of our web servers

To load-Balance across the two web servers I am going to use Linux Virtual Server (LVS)

Setting up a virtual server with two web server servers:

ipvsadm -A -t -s rr
ipvsadm -a -t -r -m
ipvsadm -a -t -r -m

The first entry assigns  port 80 on, this is the virtual server.  I have selected  the scheduling algorithm for the load balancer to be Round-Robin:

-s rr

The second and third entries are specifying the IP addresses of the web servers.

The -m is telling LVS to hide the network packets almost like a NAT hide on a router


Status of the above LVS setup:

# ipvsadm -L -n
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
  -> RemoteAddress:Port           Forward Weight ActiveConn InActConn
TCP rr
  ->                Masq    1      3          1
  ->                Masq    1      4          0