首页 > 代码库 > LVS DR脚本 解析

LVS DR脚本 解析

vip.sh

#!/bin/bashifconfig eth0:0 192.168.2.240 broadcast 192.168.2.240 netmask 255.255.255.255 uproute add -host 192.168.2.240 dev eth0:0ipvsadm -Cipvsadm -A -t 192.168.2.240:80 -s rr -p 600ipvsadm -a -t 192.168.2.240:80 -r 192.168.2.212 -gipvsadm -a -t 192.168.2.240:80 -r 192.168.2.213 -gipvsadm

LVS.sh

#!/bin/bashifconfig lo:0 192.168.2.240 broadcast 192.168.2.240 netmask 255.255.255.255 uproute add -host 192.168.2.240 dev lo:0echo "1" > /proc/sys/net/ipv4/conf/lo/arp_ignoreecho "2" > /proc/sys/net/ipv4/conf/lo/arp_announceecho "1" > /proc/sys/net/ipv4/conf/all/arp_ignoreecho "2" > /proc/sys/net/ipv4/conf/all/arp_announce

ipvsadm -L -n     #处理

LVS DR脚本 解析