Ubuntu server persistent auto reconnecting PPTP VPN connection
May 12th, 2011
I have set up a PPTP VPN client on my Ubuntu server. Unfortunately when the server reboots, the connection goes down and stays down. After a long search I found a solution on this website. It is simple bash script, which checks if the VPN server (which had the VPN ip of 10.8.3.0) is pingable. If not it restarts the PPTP VPN connection.
ping -c3 10.8.3.0 > pingreport
result=`grep "0 received" pingreport`
truncresult="`echo "$result" | sed 's/^\(.................................\).*$/\1/'`"
if [[ $truncresult == "3 packets transmitted, 0 received" ]]; then
pon company-vpn
fi
I execute this script every five minutes, by editing the /etc/crontab file and added the following rule:
*/5 * * * * root bash /root/vpn-check.sh
nice! thanks… this works perfectly for me!
thanks, this works for me too!
Perfect!!!