#!/bin/sh
line="0"
total="0"
dst=192.168.170.1 #dst ip
while [ 1 ]; do
line=`ping $dst -c 1 -s 1 -W 1 | grep "100% packet loss" | wc -l` # lost one packet then count 1
if [ "${line}" != "0" ]; then
total=$((total+1))
else
total="0" # if no lost packet then total clear to 0
fi
if [ "${total}" == "5" ]; then #total count = 5
ipsec down net-net #let net-net tunnel down
ipsec up net-net #let net-net tunnel up
fi
sleep 10 # wait 10 secend
done
推荐本站淘宝优惠价购买喜欢的宝贝:
本文链接:https://hqyman.cn/post/388.html 非本站原创文章欢迎转载,原创文章需保留本站地址!
休息一下~~