I have a VPN tunnel working from an Ubuntu server (version 16.04) when I run

openvpn /etc/openvpn/staticserver.conf

from CLI.

openvpn seems to start from the init.d script when rebooting as I get this response from running

/etc/init.d/openvpn status

● openvpn.service - OpenVPN service Loaded: loaded (/lib/systemd/system/openvpn.service; enabled; vendor preset: enabled) Active: active (exited) since Sat 2016-11-19 22:47:26 GMT; 30min ago Process: 1116 ExecStart=/bin/true (code=exited, status=0/SUCCESS) Main PID: 1116 (code=exited, status=0/SUCCESS) Tasks: 0 Memory: 0B CPU: 0 CGroup: /system.slice/openvpn.service

Nov 19 22:47:26 ubuntu systemd[1]: Starting OpenVPN service... Nov 19 22:47:26 ubuntu systemd[1]: Started OpenVPN service. Nov 19 22:48:32 ubuntu systemd[1]: Started OpenVPN service.

Which to me looks as if it started successfully.

However, the tunnel is not working (can't ping in or out).

If I issue the command

/etc/init.d/openvpn start

then the tunnel appears to start working.

What should I be doing to make sure openvpn starts properly on reboot? The server is often unattended so it is important the VPN restarts automatically on reboot.


Solved it.

At the time openvpn was running during boot, the system was not able to access the secret key which was in a subdirectory of my home. I am not experienced enough to explain this in detail. Obviously by the time the boot had finished the key was available and the running the init.d script at that time worked correctly. I solved it by moving they key.txt file to /etc/openvpn. May not be the most secure solution, but I am not concerned with security in this instance.

Lessons learned:

1) Even though it appeared that the openvpn service was running looking at the status output above

ps aux | grep openvpn

showed that it wasn't.

2) (This one is a big one for me.) Check the logfiles. It had to be enabled in the config file, but as soon as I read the log file message it was clear what the problem was. I wasted a lot of time trying to guess other solutions.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.