Skip to content

Instantly share code, notes, and snippets.

@aelveborn
Last active April 9, 2021 07:31
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save aelveborn/0a34282547a3e580c0a3 to your computer and use it in GitHub Desktop.
Save aelveborn/0a34282547a3e580c0a3 to your computer and use it in GitHub Desktop.
Synology DSM 5 VPN reconnection script.Save file to /usr/openVPNreconnect then run chmod +x /usr/openVPNreconnect. Schedule by following http://forum.synology.com/enu/viewtopic.php?f=241&t=65444
# Replace o1234567890 with your OpenVPN id. To get your id, start the VPN and run ps|grep client_o
# Replace YOUR_VPN_NAME with the name of your VPN profile in DSM 5 admin panel.
if echo `ifconfig tun0` | grep -q "00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00"
then
echo "VPN is running"
else
echo conf_id=o1234567890 > /usr/syno/etc/synovpnclient/vpnc_connecting
echo conf_name=YOUR_VPN_NAME >> /usr/syno/etc/synovpnclient/vpnc_connecting
echo proto=openvpn >> /usr/syno/etc/synovpnclient/vpnc_connecting
synovpnc reconnect --protocol=openvpn --name=YOUR_VPN_NAME
fi
exit 0
@Presjar
Copy link

Presjar commented Mar 30, 2016

Hi!

Have you noticed that this script no longer works the same on DSM6?
The VPN will be stuck as 'connecting' and never complete if the script is run as a schedule task, even as root user.
If the script is run manually via SSH as root the VPN will connect fine.

@Presjar
Copy link

Presjar commented Apr 16, 2016

tenderjackson... You are a legend! All good!

I wonder why the full path now matters... As the original script runs fine when manually run. Weird...

@riahc3
Copy link

riahc3 commented Jun 28, 2016

Does this work for L2TP/IPSec as well? What do I need to change and to what?

@saxers
Copy link

saxers commented Apr 7, 2021

Looks interesting

@saxers
Copy link

saxers commented Apr 8, 2021

I think vpn really can help in many cases. Especially when you need to get access to forbidden website or netflix. I found fastest VPN download VeePN and use it for my entertainment and work. It helped me to protect my privacy against hackers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment