×

strongswan ipsecvpn tunnel disconnect then auto updown tunnel

hqy hqy 发表于2019-03-19 23:14:34 浏览3569 评论0

抢沙发发表评论

#!/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://kinber.cn/post/388.html 转载需授权!

分享到:


推荐本站淘宝优惠价购买喜欢的宝贝:

image.png

群贤毕至

访客