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 10.10.100.90:80 -s rr
ipvsadm -a -t 10.10.100.90:80 -r 172.24.24.201:80 -m
ipvsadm -a -t 10.10.100.90:80 -r 172.24.24.202::80 -m

The first entry assigns  port 80 on 10.10.100.90, 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

-m

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  10.10.100.90:80 rr
  -> 172.24.24.201:80                Masq    1      3          1
  -> 172.24.24.202:80                Masq    1      4          0

Leave a Reply

Your email address will not be published. Required fields are marked *