You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
467 B
20 lines
467 B
#!/usr/bin/bash
|
|
|
|
VIP=192.168.96.200
|
|
NETMASK=32
|
|
|
|
case $1 in
|
|
start)
|
|
ip addr add dev lo $VIP/$NETMASK
|
|
echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore #忽略arp广播
|
|
echo 2 > /proc/sys/net/ipv4/conf/all/arp_announce #匹配精确ip地址回包
|
|
;;
|
|
stop)
|
|
ip addr del dev lo $VIP/$NETMASK
|
|
echo 0 > /proc/sys/net/ipv4/conf/all/arp_ignore
|
|
echo 0 > /proc/sys/net/ipv4/conf/all/arp_announce
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {start|stop}"
|
|
;;
|
|
esac
|
|
|