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?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
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.
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.
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
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
Open "Network Connections" window (VPN Connections -> Configure VPN)
Press "ADD" button, click on drop-down menu and pick "Import a saved VPN configuration", press Create button.
In "Select File to import" choose your "*.ovpn" file.
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.
Open "IPv4 Settings" panel and choose "Automatic (VPN) addresses only".
Open "VPN" panel again and click "Advanced" button.
Open "TLS Authentication" panel and make sure your "*.key" appeared in "Key File" field. Press Ok button.
Press "Save" button in "Editing ...your *.ovpn file name..." window.
Your VPN connection should appear in "Network Connections" window.
That's all, I hope it helps. Good luck!
It's late to answer, but I found a solution (and it is a PAIN)...
Now for the PAIN part: you will have to create 15 more FrootVPN connections since they use ports 1194-1209. Repeat Steps 7-11 above for port 1195 then again for 1196 and so on until you finish with port 1209 making sure the name in Step 8 matches the port in Step 9. I know... it sucks!
Now you can connect to FrootVPN by clicking on the Network Manager icon and going to VPN Connections. Work through the list of FrootVPN connections until you find one you can connect to.
Frankly, I wish Network Manager supported .ovpn files directly. We should be able to IMPORT the .ovpn file, Network Manager gets all the correct settings from the .ovpn file, does the correct range of gateway ports and other settings specified by the VPN provider, and saves it all as ONE connection. The .crt files should not be needed if everything is in the .ovpn file.
I answered this with a way to use Network Manager as the OP asked, but there is a MUCH BETTER WAY! All you have to do is download and install a program called gopenvpn which is available via Ubuntu Software Center. Save your .ovpn files to /etc/openvpn as admin. Open gopenvpn which should be listed under Applications > Internet and click on the .ovpn file to connect to by right-clicking on the gopenvpn icon you will see on your task bar. Easy as pie which is the way anything on a computer should be :)
Also you can bypass usernames and password by making .txt files in /etc/openvpn using this format:
Then in each of your .ovpn files (for example VPNBook .ovpn files), change the line that says this:
SED to make the replacement per line in all your .ovpn -files, etc
root@masi:/etc/openvpn# sed -i '/auth-user-pass/c\auth-user-pass nordvpn.txt' *.ovpn
Lastly ensure security and do such that others do not see your username and password
root@masi:/etc/openvpn# chmod 700 nordvpn.txt
Since this issue bit me quite a few times, I decided to also create a tool to automate the "downgrading" of the .ovpn file with embedded certs to a .ovpn file pointing to other .pem files.
Put your .ovpn file where you want it (I put it in ~/.config/openvpn/ that I created), then launch the tool
It will create all the files that were embedded in
file.ovpn into individual
In NetworkManager, select import vpn config and then choose your
~/.config/openvpn/file.ovpn. Normally, all the certificate files should point to the good one.
But another bug made that NetworkManager doesn't detect the key direction from the Advanced settings of TLS Auth. So you need to put it to the right direction also…
And after that, you save and you should be good to go.
This tool will help with the use of the kylemanna/openvpn docker image which create all the certificates and the TLS Auth.