You have to choose a different IP address for your VIP.
For example if you have 3 real servers with ips 192.168.0.11,192.168.0.12, 192.168.0.13 you would like to use 192.168.0.10 as your VIP.
So you have to configure the VIP on each server.
/sbin/ip addr add 192.168.100.30 dev eth1
You can follow this link if you want:
http://kezhong.wordpress.com/2010/03/28/setup-linux-loadbalancer-with-piranha-and-lvs-on-centos-5-4/
Here comes the text of the tutorial (:
Test environment:
LVS Router 1: eth0: 192.168.26.201
LVS Router 2: eth0: 192.168.26.202
Real Server 1: eth0: 192.168.26.211
Real Server 2: eth0: 192.168.26.212
VIP: 192.168.26.200
gateway: 192.168.26.1
Install piranha and ipvsadm packages on the LVS Routers
# yum install ipvsadm
# yum install piranha
Configure Services on the LVS Routers
# chkconfig pulse on
# chkconfig piranha-gui on
# chkconfig httpd on
Set a Password for the Piranha Configuration Tool
# piranha-passwd
Turn on Packet Forwarding on the LVS Routers
# echo 1 > /proc/sys/net/ipv4/ip_forward
Start the Piranha Configuration Tool Service
Change the SELinux mode to permissive. If you didn’t do it, it would show the error message as below when you start the piranha-gui
service.
Starting piranha-gui: (13)Permission denied: make_sock: could not bind to address [::]:3636
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:3636
No listening sockets available, shutting down
Unable to open logs
# setenforce 0
# service httpd start
# service piranha-gui start
Configure the LVS Routers with Piranha Configuration Tool
Open http://192
.168
.26
.201
:3636 in a Web browser to access the Piranha Configuration Tool. Click on the Login button and enter piranha for the Username and the administrative password you created in the Password field.
Click on the GLOBAL SETTINGS panel, and input the primary server public IP, and then click the ACCEPT button.
Click on the REDUNDANCY panel, and input the redundant server public IP, and then click the ACCEPT button.
Click on the VIRTUAL SERVERS panel, add a server, edit it, and activate it.
Clicking on the REAL SERVER subsection link at the top of the panel displays the EDIT REAL SERVER subsection. Click the ADD button to add new servers, edit them and activate them.
Copy the lvs.cf file to another LVS router.
# scp /etc/sysconfig/ha/lvs.cf root@192.168.26.202:/etc/sysconfig/ha/lvs.cf
Start the pulse services on the LVS Routers
# service pulse restart