1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-vps.git synced 2025-03-09 15:50:00 +00:00

Add Ubuntu Server 18.04 support

This commit is contained in:
Ycarus (Yannick Chabanois) 2018-11-12 18:27:32 +00:00
parent 2cc57519b6
commit dc342613a6
7 changed files with 81 additions and 36 deletions

View file

@ -32,7 +32,7 @@ ip route replace fd00::/8 via fe80::a00:2 dev omr-6in4
_ping() {
local host=$1
ret=$(ping -4 "${host}" \
-W 5 \
-W 3 \
-c 1 \
-q
) && echo "$ret" | grep -sq "0% packet loss" && {
@ -41,6 +41,19 @@ _ping() {
false
}
_ping_range() {
local network=$1
for i in {2..10} ;do
_ping $network$i
pingr=$?
if $(exit $pingr); then
ipd=$network$i
return
fi
done
false
}
while true; do
source /etc/shorewall/params.vpn
iface=""
@ -60,8 +73,9 @@ $allip_openvpn
$allip_mlvpn"
while IFS= read -r inet; do
ip=$(echo $inet | awk '{print $2}' | cut -d/ -f1 | tr -d "\n")
ipd=$(echo $ip | sed 's/.1/.2/' | tr -d "\n")
if [ "$ipd" != "" ]; then
_ping_range $(echo $ip | sed 's/.1/./' | tr -d "\n")
statusr=$?
if $(exit $statusr); then
_ping $ipd
statusp=$?
if $(exit $statusp); then
@ -75,10 +89,10 @@ $allip_mlvpn"
fi
fi
done < <(printf '%s\n' "$allip")
[ -z "$iface" ] && {
systemctl -q restart systemd-networkd
sleep 10
}
#[ -z "$iface" ] && {
# systemctl -q restart systemd-networkd
# sleep 10
#}
fi
fi
sleep 5