Importing OpenVPN Access Server (.ovpn) Profiles into Linux NetworkManager via nmcli

Importing OpenVPN Access Server (.ovpn) Profiles into Linux NetworkManager via nmcli

Importing profiles from OpenVPN Access Server (OpenVPNAS) on Linux has been a challenge for quite a few users. OpenVPN Access Server (OpenVPNAS) gives us a single configuration file and does not split this out which is good for usage on mobile devices and many clients but not on the GNOME-based GUI.

The reason behind this is that on GNOME-based desktop environments the ability to import a single file, from the GUI, does not work with the regular import functionality. There are a few tips and tricks that I have used to get this done. The easiest by far is to make sure you’re using a newer version.

Make sure the version is 1.8.4 or greater for Network Manager and that you have the openvpn package installed, as well as ​network-manager-openvpn package installed. I will walk through how to do this on a Debian- or Ubuntu-based system.

bash
sudo apt-get install openvpn network-manager-openvpn

From here we will need to run the actual import operations. Importing into network manager from the OpenVPN Access server on Ubuntu or other Debian- or Ubuntu-based systems is relatively straightforward. There is a need to use the command line as well as a single CLI command.

You will first need to download your OpenVPN configuration profile (.ovpn). You should check with your VPN provider or IT team for the location of your VPN server and login credentials.

Once you have your VPN profile downloaded you will do the following easy step:

bash
sudo nmcli connection import type openvpn file profile.ovpn

After this is done you should see the option to connect to your VPN server on the network connection drop-down in GNOME, or other GNOME-based GUI.

For any other usage of the nmcli commands you should be able to use tab completion like so:

bash
$ sudo nmcli [TAB]
agent       connection  device      general     help        monitor     networking  radio       
$ sudo nmcli connection [TAB]
add      clone    delete   down     edit     export   help     import   load     modify   monitor  reload   show     up       
$ sudo nmcli connection edit [TAB]

>_ Engineering Discussion 1 Comment

+ Add Field Note ↓
  1. Great walkthrough James! Importing the .ovpn profile via nmcli on headless Ubuntu nodes saved us from manually splitting out inline CA and TLS-auth blocks.

Leave a Technical Comment

Share CLI tips, hardware notes, or questions below. Inline backticks (`command`) are supported.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Engineering Notes