有时希望使用多个VIP测试,就需要在RS上绑定多个VIP。
- #!/bin/bash
-
VIP='10.253.66.13 10.253.3.22'
-
case $1 in
-
start)
-
modprobe -r ipip
-
modprobe ipip
-
ip link set tunl0 up
-
ip link set tunl0 arp off
-
for IP in $VIP
-
do
-
ip addr add $IP/32 br $IP dev tunl0
- #如果觉得都是放在tunl0不能使用ifconfig察看的话也可以使用
- #NO=$((NO+1))
- #ip addr add $IP/32 br $IP label tunl0:$NO dev tunl0
-
ip route add $IP/32 dev tunl0
-
done
-
echo 1 > /proc/sys/net/ipv4/conf/tunl0/arp_ignore
-
echo 2 > /proc/sys/net/ipv4/conf/tunl0/arp_announce
-
echo 0 > /proc/sys/net/ipv4/conf/tunl0/rp_filter
-
echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore
-
echo 2 > /proc/sys/net/ipv4/conf/all/arp_announce
-
;;
-
stop)
-
echo 0 > /proc/sys/net/ipv4/conf/tunl0/arp_ignore
-
echo 0 > /proc/sys/net/ipv4/conf/tunl0/arp_announce
-
echo 1 > /proc/sys/net/ipv4/conf/tunl0/rp_filter
-
echo 0 > /proc/sys/net/ipv4/conf/all/arp_ignore
-
echo 0 > /proc/sys/net/ipv4/conf/all/arp_announce
-
modprobe -r ipip
-
;;
-
*)
-
echo "$0: Usage: $0 {start|stop|status}"
-
exit 1
-
;;
-
esac
在加载好ipip模块后就会有默认的tunl0隧道。然后使用ip addr add添加ip,用ip route添加路由。
阅读(3128) | 评论(0) | 转发(0) |