this post was submitted on 14 Jun 2023
3 points (100.0% liked)
Synology
965 readers
1 users here now
Synology
This is a place for all topics regarding Synology hard- and software - especially (but not limited to) their NAS devices.
Just one thing: Let’s please be pleasant to each other and respect that people have different experience levels. Some are pros, some are noobs, yet everybody may have good ideas or interesting questions to ask and comments to make, and all of these shall be heard and appreciated. ❤️
And since we know from TV that all IT nerds 🤓 are h4xx0rs
and wear hoodies all the time (if not even ski masks) in front of their computers, I chose an appropriate banner image (image credit).
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I gave up on DSM's own VPN client setup, because IIRC first it only supports OpenVPN, and 2nd it tends to quietly disconnect from the VPN server even if keep-alive is enabled.
But if you do want to stick with DSM VPN, I wrote a script before that would help revive the connection even if it gets severed. Maybe this will help you. Let me know if you want to give it a try, so I can see if I still have it somewhere to share with you.
Yes, this is exactly what happens to my connection. If you still have your script around feel free to share it. I will have a look at it since I don't have any experience with dockers. Thx very much.
Ok once I get home tonight I will search for it. It worked pretty well actually but eventually I made the switch to docker VPN anyway because of Wireguard support.
My script writing skills are pretty bad. So while this has worked for me, if you are up for it feel free to modify it any way you want.
First save this script somewhere in your home folder (or any folder of your choice). Name it vpn_watchdog.sh:
You will then need to change something in the script:
Quoting the relevant info from this site: The DSM comes with a command line tool to manage the VPN connection. As you’ll see the ergonomy is debatable, but it allows to initiate the connection from the shell. This tool is synovpnc, but before we can use it, we need the following file: /usr/syno/etc/synovpnclient/vpnc_connecting This is a temporary file that lives only a few seconds after you click “Connect” in the VPN configuration GUI. Your mission is to click on “Connect” and cat this file so you can see the configuration. It should be something among those lines: conf_id=o1481981647 conf_name=MyVpnConnection proto=openvpn The conf_id and conf_name is what we are after.
Once found, just change o1663422808 and Surfshark_HK with the names you found following the above instructions.
(Edit: Note - there are multiple occurrences of o1663422808 (and possibly Surfshark_HK) in the script, so change all occurrences) Now that we have created the script, 2 additional steps are needed:
cd to /usr/local/etc/rc.d , then create a 'startup.sh' with the following content:
Again, change xxxxx with your home folder (or whatever folder you placed the watchdog script in).
Also, remember to 'chmod +x' the scripts so they become executable.
That's all I can think of. Good luck !
Thx very much, will have a look at it on the weekend ;)
My script writing skills are pretty bad. So while this has worked for me, if you are up for it feel free to modify it any way you want.
First save this script somewhere in your home folder (or any folder of your choice). Name it vpn_watchdog.sh:
You will then need to change something in the script:
Quoting the relevant info from this site: The DSM comes with a command line tool to manage the VPN connection. As you’ll see the ergonomy is debatable, but it allows to initiate the connection from the shell. This tool is synovpnc, but before we can use it, we need the following file: /usr/syno/etc/synovpnclient/vpnc_connecting This is a temporary file that lives only a few seconds after you click “Connect” in the VPN configuration GUI. Your mission is to click on “Connect” and cat this file so you can see the configuration. It should be something among those lines: conf_id=o1481981647 conf_name=MyVpnConnection proto=openvpn The conf_id and conf_name is what we are after.
Once found, just change o1663422808 and Surfshark_HK with the names you found following the above instructions.
(Edit: Note - there are multiple occurrences of o1663422808 (and possibly Surfshark_HK) in the script, so change all occurrences) Now that we have created the script, 2 additional steps are needed:
cd to /usr/local/etc/rc.d , then create a 'startup.sh' with the following content:
Again, change xxxxx with your home folder (or whatever folder you placed the watchdog script in).
Also, remember to 'chmod +x' the scripts so they become executable.
That's all I can think of. Good luck !