#!/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