The automatic reconnection of VPN profile on Synology NAS has failed

Een reactie plaatsen

oktober 12, 2016 door Tim

1. Let’s use the urls above as a reference of our next steps

2. For PPTP setup reproduce every step but replace l2tp with pptp
Need openvpn? : http://der-zyklop.de/blog/the-reconnection-of-vpn-profile-onsynology-nas-has-failed

3. We need to connect to our Diskstation via SSH on Mac open Terminal and type:

ssh -l root 192.168.x.x

*replace ip with your Diskstation IP address & insert your Diskstation password

4. To find your config ID needed below, type:

cat /usr/syno/etc/synovpnclient/l2tp/l2tpclient.conf

* at the top of the response you should see something like [l1430610050] in this case id is: l1430610050

5. Now let’s create a new script and open it with the text-editor vi

touch /usr/l2tpVPNreconnect
chmod +x /usr/l2tpVPNreconnect
vi /usr/l2tpVPNreconnect

* vi editor has 2 modes edit/preview to switch in between them hit “a” for edit, “esc” to exit edit mode & “o” for the new line. Other useful commands are: once you hit “esc” type:
“:x!” for exit & save
“:q!” for exit without save

if ifconfig | grep -q "inet addr:10."
then
echo "L2TP VPN is Running"
else
echo conf_id=YOURCONFID > /usr/syno/etc/synovpnclient/vpnc_connecting
echo conf_name=YOUR_VPN_NAME >> /usr/syno/etc/synovpnclient/vpnc_connecting
echo proto=l2tp >> /usr/syno/etc/synovpnclient/vpnc_connecting
synovpnc reconnect --protocol=l2tp --name=YOUR_VPN_NAME
fi
exit 0

* Replace YOURCONFID and YOUR_VPN_NAME with your stuff and save the file by hitting ESC and then type : x! and hit ENTER

6. To test your script, type:

/usr/l2tpVPNreconnect

7. Now you can edit a cron manually as Nils did or use build in Task Scheduler to run your script…I gonna use task scheduler for this example.

8. Access Task Scheduler -> Go to Control Panel -> System Tab -> Task Scheduler

9. Hit Create & Select User-defined Script

10. Add the task name & in the Run Command textarea paste this:

/usr/l2tpVPNreconnect

11. Schedule Tab -> Run Daily, First run (stick next hour of your time) & Frequency every hour.

Geef een reactie

Vul je gegevens in of klik op een icoon om in te loggen.

WordPress.com logo

Je reageert onder je WordPress.com account. Log uit / Bijwerken )

Twitter-afbeelding

Je reageert onder je Twitter account. Log uit / Bijwerken )

Facebook foto

Je reageert onder je Facebook account. Log uit / Bijwerken )

Google+ photo

Je reageert onder je Google+ account. Log uit / Bijwerken )

Verbinden met %s

Kalender

oktober 2016
M D W D V Z Z
« Aug    
 12
3456789
10111213141516
17181920212223
24252627282930
31  

Blog Stats

  • 203,580 hits

My Bookmarks

%d bloggers op de volgende wijze: