How can I use a .ovpn file with Network Manager?

I have a .ovpn file with my VPN config - it works fine when I do

sudo openvpn --config ~jrg/Documents/vpn-config.ovpn 

in the terminal, but I'd like to use Network Manager. How can I do this?


First, install the OpenVPN Network Manager plugin:

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

Open Network Manager, click "Add" and from the opened window select "Import a saved VPN configuration..." under "Choose a Connection Type". Navigate to your .ovpn file (~jrg/Documents/vpn-config.ovpn). If it doesn't automatically find your certificates/keys (the paths of which are found in the .ovpn file), you can select them here, or make any other small changes.

openvpn dialog

One other thing that may save you some headache down the road is to click IPv4 Settings, then change the method to "Automatic (VPN) Addresses Only". When kept at the default, this will cause ALL internet traffic to go over the VPN, regardless of your .ovpn settings. Here you can also set the DNS server and search domains to use while connected.

openvpn dialog


My own experience of successful VPN connection establishing on Ubuntu 14.04.

Our admin gave me 3 files to install them into openVPN for Windows 7: *.ovpn, *.crt, *.key

  1. Execute the following commands in your Ubuntu terminal:

    sudo apt-get install openvpn network-manager-openvpn network-manager-openvpn-gnome network-manager-vpnc
    sudo /etc/init.d/networking restart
    
  2. Open "Network Connections" window (VPN Connections -> Configure VPN)

  3. Press "ADD" button, click on drop-down menu and pick "Import a saved VPN configuration", press Create button.

  4. In "Select File to import" choose your "*.ovpn" file.

  5. In "Editing ...your *.ovpn file name..." window enter your username and password for vpn. Make sure that a *.crt file appeared in CA Certificate field.

  6. Open "IPv4 Settings" panel and choose "Automatic (VPN) addresses only".

  7. Open "VPN" panel again and click "Advanced" button.

  8. Open "TLS Authentication" panel and make sure your "*.key" appeared in "Key File" field. Press Ok button.

  9. Press "Save" button in "Editing ...your *.ovpn file name..." window.

  10. Your VPN connection should appear in "Network Connections" window.

That's all, I hope it helps. Good luck!