LVS DR脚本 解析

vip.sh

#!/bin/bash
ifconfig eth0:0 192.168.2.240 broadcast 192.168.2.240 netmask 255.255.255.255 up
route add -host 192.168.2.240 dev eth0:0
ipvsadm -C
ipvsadm -A -t 192.168.2.240:80 -s rr -p 600
ipvsadm -a -t 192.168.2.240:80 -r 192.168.2.212 -g
ipvsadm -a -t 192.168.2.240:80 -r 192.168.2.213 -g
ipvsadm

LVS.sh

#!/bin/bash
ifconfig lo:0 192.168.2.240 broadcast 192.168.2.240 netmask 255.255.255.255 up
route add -host 192.168.2.240 dev lo:0
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

ipvsadm -L -n     #处理

你可能感兴趣的:(LVS)