OpenVPN has feature that exports client configuration files. While it is definitely possible to run OpenVPN from the command line, I prefer to have a GUI that allows me to easily connect/disconnect from VPN. Ubuntu’s network manager and the .ovpn configuration files exported from OpenVPN does not play well together, however.
There is a workaround which involves cutting and pasting parts of the configuration file into separate files and adding some references to them in the configuration. After having done this a couple of times and helped other people with the same issue, I decided I’d write a simple tool to do the job instead.
openvpn-config-splitter is a very simple CLI-tool I wrote in node.js. It does most of the hard work for you, but you’ll still have to import the configuration and possibly change a few settings. Here’s a step-by-step guide on how to get OpenVPN installed, integrated with the network manager in Ubuntu (or Debian, Linux Mint etc.) and how to get your configuration imported:
- Install OpenVPN along with the OpenVPN extensions:
sudo apt-get install network-manager-openvpn network-manager-openvpn-gnome
- Make sure you’ve got node.js installed (
apt-get install nodejs), and run
npm install -g openvpn-config-splitter(you might have to use
sudoto install globally).
- Get your OpenVPN configuration file (ask your sysadmin if you’re not sure where/how) and put it somewhere you’ll find it, say
ovpnsplit ~/openvpn/client.ovpn(path to your configuration file) – after running this, you should be able to find a bunch of other files in the same folder (
client.keyand a few others).
- Open the network manager (it varies a bit from distro to distro) – somewhere in there you’ll find an option to add a VPN connection. When it prompts you to choose a VPN connection type, select “Import a saved VPN configuration” from the dropdown (or find a different import option, somewhere) and browse to the folder you stored your configuration file in.
- Make sure you select the altered configuration file (it should be postfixed with
- You’ll probably have to enter your username and password. Click save and try to connect!
If you run into a problem where you can only access resources on your organizations network, open up the VPN settings, go to “IPv4 Settings” and select “Automatic (VPN) addresses only“, then click on the “Routes” button. Check the “Use this connection only for resources on its network“-option and save the configuration. Disconnect, then reconnect. Hopefully you should be up and running!
If you have any issues reaching resources on your organizations network, you might have to set up one or more DNS-servers under the “IPv4 Settings”-tab, along with one or more search domains. Your sysadmin should be able to give you those settings, if needed.