1. 程式人生 > >23:LVS客戶端配置腳本案例

23:LVS客戶端配置腳本案例

sys pan lvs prev all eof rip announce bin

[root@web03 scripts]# cat prevent_arp.sh 
#!/bin/bash

lo_ip=$(ip a s lo|grep "10.0.0.1[3]/32"|wc -l)

if [ $lo_ip -eq 0 ]
then
    ip addr add 10.0.0.13/32 dev lo
fi

ip_cnf=$(egrep "net.ipv4.conf" /etc/sysctl.conf|wc -l)

if [ $ip_cnf -lt 4 ]
then
    
    cat >>/etc/sysctl.conf<<-EOF
    net.ipv4.conf.all.arp_ignore 
= 1 net.ipv4.conf.all.arp_announce = 2 net.ipv4.conf.lo.arp_ignore = 1 net.ipv4.conf.lo.arp_announce = 2 EOF sysctl -p fi

23:LVS客戶端配置腳本案例