两台机器:ip1:192.168.1.231
ip2:192.168.1.232
虚ip:192.168.1.233
1、先装好ipvsadmin
2、#echo 1 > /proc/sys/net/ipv4/conf/lo/arp_ignore
#echo 2 > /proc/sys/net/ipv4/conf/lo/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.233 broadcast 192.168.1。233 netmask 255.255.255.255 up
#route add -host 192.168.1.233 dev lo:0
在两台机器上都做一遍
3、 #ifconfig eth0:1 192.168.1.233 broadcast 192.168.1.233 netmask 255.255.255.255 up
#route add -host 192.168.1.233 dev eth0:1
#echo 1 > /proc/sys/net/ipv4/ip_forward
根据转发服务的端口来设置
#ipvsadm -A -t 192.168.1.233:8080 -s wlc //设置新的转发服务
#ipvsadm -a -t 192.168.1.233:8080 -r 192.168.1.231 -g -w 20
#ipvsadm -a -t 192.168.1.233:8080 -r 192.168.1.232 -g -w 10