Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Enabling OpenVPN Configuration/Autostart on Ubuntu

DZone's Guide to

Enabling OpenVPN Configuration/Autostart on Ubuntu

Here's a quick guide to getting started with OpenVPN on Ubuntu!

· Integration Zone
Free Resource

Build APIs from SQL and NoSQL or Salesforce data sources in seconds. Read the Creating REST APIs white paper, brought to you in partnership with CA Technologies.

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:

  • Your configuration has to be under /etc/openvpn/FILENAME.conf. The .conf part is important. If it ends with .ovpn or anything else, it won't be loaded.
  • Ubuntu isn't set to start all configurations by default. You can change this by editing /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.
  • You have to tell systemd that you've changed the default file. If you don't do this, nothing will have appeared to change for OpenVPN - unless you restart the OS. And you don't want to restart your server just to make a setting visible. Do systemctl daemon-reload to 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).
  • Restart OpenVPN: service openvpn restart
  • Confirm that everything went OK by looking in /var/log/syslog
  • The Integration Zone is brought to you in partnership with CA Technologies.  Use CA Live API Creator to quickly create complete application backends, with secure APIs and robust application logic, in an easy to use interface.

    Topics:
    vpn ,ubuntu ,service

    Published at DZone with permission of Mats Lindh, DZone MVB. See the original article here.

    Opinions expressed by DZone contributors are their own.

    THE DZONE NEWSLETTER

    Dev Resources & Solutions Straight to Your Inbox

    Thanks for subscribing!

    Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

    X

    {{ parent.title || parent.header.title}}

    {{ parent.tldr }}

    {{ parent.urlSource.name }}