Enabling OpenVPN Configuration/Autostart on Ubuntu
Here's a quick guide to getting started with OpenVPN on Ubuntu!
Join the DZone community and get the full member experience.Join For Free
This assumes that you’ve already made sure that your configuration is valid and is able to connect (you can do this by calling
openvpn --config /etc/openvpn/FILENAME.confdirectly. It won’t be daemonized, but it will give you any errors on the console directly).
There are a few details you’ll have to get right before the OpenVPN daemon starts your configuration automagically under Ubuntu:
/etc/openvpn/FILENAME.conf. The .conf part is important. If it ends with .ovpn or anything else, it won't be loaded.
/etc/default/openvpn. Change the AUTOSTART variable to the configurations you want to start when the daemon starts. The example in the file says "all", which means that all defined configurations will start. This is OK if you want to keep OpenVPN up at all times.
systemctl daemon-reloadto make systemd reload the settings (this is also in the comments in the file, but hey, you don't have time to read those, so now you're searching Google instead).
service openvpn restart
Published at DZone with permission of Mats Lindh, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.