vip.sh
#!/bin/bash
ifconfig eth0: 192.168.2.240 broadcast 192.168.2.240 netmask 255.255.255.255 up
route add -host 192.168.2.240 dev eth0:
ipvsadm -C
ipvsadm -A -t 192.168.2.240: -s rr -p
ipvsadm -a -t 192.168.2.240: -r 192.168.2.212 -g
ipvsadm -a -t 192.168.2.240: -r 192.168.2.213 -g
ipvsadm
LVS.sh
#!/bin/bash
ifconfig lo: 192.168.2.240 broadcast 192.168.2.240 netmask 255.255.255.255 up
route add -host 192.168.2.240 dev lo:
echo "" > /proc/sys/net/ipv4/conf/lo/arp_ignore
echo "" > /proc/sys/net/ipv4/conf/lo/arp_announce echo "" > /proc/sys/net/ipv4/conf/all/arp_ignore
echo "" > /proc/sys/net/ipv4/conf/all/arp_announce
ipvsadm -L -n #处理