---
title: "Import OpenVPN file with Network Manager or Linux"
slug: "import-openvpn-file-with-network-manager-or-linux"
updated: 2023-11-30T23:48:17Z
published: 2023-11-30T23:48:17Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://docs.imat.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Import OpenVPN file with NetworkManager or Linux

This page explains how to import the .opvn (OpenVPN config) file using a GUI or Command Line Interface (CLI) method in Linux.

|  | Tutorial Details |
| --- | --- |
| Difficulty level | Easy |
| Requirements | Root privilegesLinux terminalNetwork Manager |
| OS compatibility | Alma • Alpine • Arch • CentOS • Debian • Fedora • Linux • macOS • Mint • openSUSE • Pop!_OS • RHEL • Rocky • Stream • SUSE • Ubuntu |

## Install OpenVPN Plugin

Type the following `apt-get` command or `apt` command to install the Gnome NetworkManager OpenVPN plugin under Debian or Ubuntu Linux. For example: `$ sudo apt install network-manager-openvpn-gnome openvpn-systemd-resolved` Sample output:

```
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libnm-glib-vpn1 libnss-resolve libpkcs11-helper1 network-manager-openvpn openvpn
Suggested packages:
  resolvconf easy-rsa
The following NEW packages will be installed:
  libnm-glib-vpn1 libnss-resolve libpkcs11-helper1 network-manager-openvpn network-manager-openvpn-gnome openvpn openvpn-systemd-resolved
0 upgraded, 7 newly installed, 0 to remove and 0 not upgraded.
Need to get 747 kB of archives.
After this operation, 2,345 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://in.archive.ubuntu.com/ubuntu artful/main amd64 libnm-glib-vpn1 amd64 1.8.4-1ubuntu3 [13.8 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu artful/universe amd64 libnss-resolve amd64 234-2ubuntu12 [110 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu artful/main amd64 libpkcs11-helper1 amd64 1.22-2 [44.2 kB]
Get:4 http://in.archive.ubuntu.com/ubuntu artful/main amd64 openvpn amd64 2.4.3-4ubuntu1 [469 kB]
Get:5 http://in.archive.ubuntu.com/ubuntu artful/main amd64 network-manager-openvpn amd64 1.2.10-0ubuntu2 [30.6 kB]
Get:6 http://in.archive.ubuntu.com/ubuntu artful/universe amd64 network-manager-openvpn-gnome amd64 1.2.10-0ubuntu2 [71.0 kB]
Get:7 http://in.archive.ubuntu.com/ubuntu artful/universe amd64 openvpn-systemd-resolved amd64 1.2.6-1 [8,626 B]
Fetched 747 kB in 3s (206 kB/s)                      
Preconfiguring packages …
Selecting previously unselected package libnm-glib-vpn1:amd64.
(Reading database ... 197667 files and directories currently installed.)
Preparing to unpack .../0-libnm-glib-vpn1_1.8.4-1ubuntu3_amd64.deb …
Unpacking libnm-glib-vpn1:amd64 (1.8.4-1ubuntu3) …
Selecting previously unselected package libnss-resolve:amd64.
Preparing to unpack .../1-libnss-resolve_234-2ubuntu12_amd64.deb …
Unpacking libnss-resolve:amd64 (234-2ubuntu12) …
Selecting previously unselected package libpkcs11-helper1:amd64.
Preparing to unpack .../2-libpkcs11-helper1_1.22-2_amd64.deb …
Unpacking libpkcs11-helper1:amd64 (1.22-2) …
Selecting previously unselected package openvpn.
Preparing to unpack .../3-openvpn_2.4.3-4ubuntu1_amd64.deb …
Unpacking openvpn (2.4.3-4ubuntu1) …
Selecting previously unselected package network-manager-openvpn.
Preparing to unpack .../4-network-manager-openvpn_1.2.10-0ubuntu2_amd64.deb …
Unpacking network-manager-openvpn (1.2.10-0ubuntu2) …
Selecting previously unselected package network-manager-openvpn-gnome.
Preparing to unpack .../5-network-manager-openvpn-gnome_1.2.10-0ubuntu2_amd64.deb …
Unpacking network-manager-openvpn-gnome (1.2.10-0ubuntu2) …
Selecting previously unselected package openvpn-systemd-resolved.
Preparing to unpack .../6-openvpn-systemd-resolved_1.2.6-1_amd64.deb …
Unpacking openvpn-systemd-resolved (1.2.6-1) …
Setting up libnm-glib-vpn1:amd64 (1.8.4-1ubuntu3) …
Processing triggers for ureadahead (0.100.0-20) …
Setting up libpkcs11-helper1:amd64 (1.22-2) …
Setting up openvpn (2.4.3-4ubuntu1) …
Processing triggers for libc-bin (2.26-0ubuntu2) …
Processing triggers for systemd (234-2ubuntu12) …
Setting up libnss-resolve:amd64 (234-2ubuntu12) …
First installation detected…
Checking NSS setup…
Processing triggers for man-db (2.7.6.1-2) …
Processing triggers for dbus (1.10.22-1ubuntu1) …
Setting up openvpn-systemd-resolved (1.2.6-1) …
Setting up network-manager-openvpn (1.2.10-0ubuntu2) …
Setting up network-manager-openvpn-gnome (1.2.10-0ubuntu2) …
Processing triggers for libc-bin (2.26-0ubuntu2) ...
```

For RHEL/CentOS and co use the `dnf` command/`yum` command to install openvpn including network-manager-openvpn-gnome packages.

## Method 1—Import OpenVPN config file from command line with NetworkManager

Open the Terminal application. The syntax is: `$ sudo nmcli connection import type openvpn file /path/to/your.ovpn` For example: `$ sudo nmcli connection import type openvpn file /home/vivek/ubuntu16.04LTS.ovpn` Sample outputs: `Connection 'ubuntu16.04LTS' (989b8c5a-0851-48ae-813c-c74eb593014d) successfully added.`

Your connection is called ‘ubuntu16.04LTS’ and to make connection to the OpenVPN server, run: `$ nmcli connection up ubuntu16.04LTS` Sample outputs: `Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/27)`

To see OpenVPN connection details: `$ nmcli connection show ubuntu16.04LTS`

To see IPv4/IPv6 OpenVPN client IP and other info, run:

```
$ nmcli connection show ubuntu16.04LTS | egrep -i 'IP4|IPV6'
$ nmcli connection show ubuntu16.04LTS | egrep -i 'IP4'
Sample outputs:
IP4.ADDRESS[1]:                         10.8.0.8/24
IP4.GATEWAY:                            10.8.0.1
IP4.DNS[1]:                             10.8.0.1
```

Verify it with the ping command i.e. send ping-pong requests to OpenVPN gateway: `$ ping -c 4 10.8.0.1` Sample outputs:

```
PING vpn (10.8.0.1) 56(84) bytes of data.
64 bytes from vpn (10.8.0.1): icmp_seq=1 ttl=64 time=288 ms
64 bytes from vpn (10.8.0.1): icmp_seq=2 ttl=64 time=279 ms
64 bytes from vpn (10.8.0.1): icmp_seq=3 ttl=64 time=172 ms
64 bytes from vpn (10.8.0.1): icmp_seq=4 ttl=64 time=77.5 ms
 
--- vpn ping statistics —
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 77.547/204.609/288.526/86.425 ms
```

## Method 2—Import a .ovpn file with Network Manager GUI

Open Network Manager from Gnome settings option and select **Network** tab and click on the **VPN +** symbol: ![image.png](https://cdn.document360.io/5bf5f14a-9e3f-48aa-a2b9-2be6d9100091/Images/Documentation/image%285%29.png)

From the **Add VPN** windows, click on the **Import from file…** option: ![image.png](https://cdn.document360.io/5bf5f14a-9e3f-48aa-a2b9-2be6d9100091/Images/Documentation/image%286%29.png)

Navigate to your .ovpn file (<samp data-tomark-pass="">/home/vivek/ubuntu16.04LTS.ovpn</samp>) and click **Open**: ![image.png](https://cdn.document360.io/5bf5f14a-9e3f-48aa-a2b9-2be6d9100091/Images/Documentation/image%287%29.png)

Click on the **Add** button: ![image.png](https://cdn.document360.io/5bf5f14a-9e3f-48aa-a2b9-2be6d9100091/Images/Documentation/image%288%29.png)

Finally, click on off button to turn on the VPN: ![image.png](https://cdn.document360.io/5bf5f14a-9e3f-48aa-a2b9-2be6d9100091/Images/Documentation/image%289%29.png)

If the connection stays on you should be connected to the VPN.
