]>
git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/scripts/vpn-restart
2 # VPN Restart/Checker by Figo
4 #####################################################
5 part
=xxxx
#partner frei Wählbar
6 net
=xxxx.homeip.net
#Partner DYNDNS Adresse
7 vpn
=xxxx
#VPN Name wie unter GUI
8 iplocal
=192.168.x.x
#Lokale IP
9 ipremote
=192.168.x.x
#Partner IP
10 LOGFILE
=/var
/log
/vpn_
$vpn.log
11 maxlog
=2000 #Max groesse des Logfiles in Byte
12 #####################################################
16 echo "##############################################"
17 echo "# $part ist offline #"
18 echo "# Verbindung zu $part nicht moeglich #"
19 echo "$(date) $part ist offline #" >> $LOGFILE
20 echo "$(date) Verbindung zu $part nicht moeglich #" >> $LOGFILE
21 echo "##############################################"
24 echo "##############################################"
25 echo "# Na ein Glueck $part is online #"
26 echo "##############################################"
27 /usr
/bin
/ping -i 2 -c 2 -n -I $iplocal $ipremote
28 if test $?
-ne 0; then
30 echo "##############################################"
31 echo "# `grep -c ms $LOGFILE` #"
33 echo "##############################################"
34 echo "$(date) Tunnel zu $part ist NICHT da #" >> $LOGFILE
35 echo "$(date) Starte Tunnel $vpn neu #" >> $LOGFILE
36 echo "# Tunnel zu $part ist NICHT da #"
37 echo "# Starte Tunnel $vpn neu #"
38 echo "##############################################"
39 ipsec auto
--replace $vpn
40 ipsec auto
--rereadsecrets
44 echo "###############################################"
45 echo "$(date) Tunnel zu $part steht #" >> $LOGFILE
47 echo "# Tunnel zu $part steht #"
48 echo " seine WAN IP ist `host $net | cut -d" " -f4` "
49 echo "# seine Lokale IP ist $ipremote #"
50 echo "###############################################"
53 if test `stat -c %s $LOGFILE` -lt $maxlog; then
54 echo "# $LOGFILE < $maxlog Bytes #"
56 echo "##############################################"
57 echo "# $LOGFILE > $maxlog Bytes #"
58 echo "# Maximale groesse des Logfile #"
59 echo "# Logfile wird geloescht #"
60 echo "##############################################"