I'm trying to setup OpenVPN using NetworkManager. The GUI seems buggy and unresponsive. Are there any other tools for setting up a VPN client?
-
2Becareful about DNS leak of openvpn on Ubuntu. Fix: http://www.ubuntubuzz.com/2015/09/how-to-fix-openvpn-dns-leak-in-linux.html – Xaqron Mar 18 '17 at 12:55
7 Answers
Yes, you can use OpenVPN directly. This way you can use more settings as well.
First you need the openvpn package:
sudo apt-get install openvpn
Then you can connect like this:
sudo openvpn --config /path/to/config.ovpn
The sudo is important because OpenVPN won't be able to connect otherwise (I think because it has to change the routes).
- 11,755
- 6
- 44
- 50
-
-
4
-
19To make it permanent, edit `/etc/default/openvpn` and uncomment the line `AUTOSTART="all"` and copy your ovpn file to `/etc/openvpn/config.conf` - must has .conf extension – Thales Ceolin Jun 25 '15 at 21:59
-
3@YanKingYin you should be able to download it by logging to your vpn server from browser. – Aniket Thakur Jul 31 '15 at 18:21
-
-
1
-
-
3
-
2can you mention how to launch the VPN on boot? systemctl? how to stop the vpn client? I agree with @Luka it seems weird that it's not `openvpn --client` or something, since it seems like this would launch a server. – Alexander Mills Jan 28 '20 at 02:02
Easiest method is running this command:
sudo apt-get install network-manager-openvpn-gnome
And then add a OpenVPN connection from Network Manager which after above command supports importing .ovpn files.
- 1,262
- 11
- 14
-
1I tried using this, but couldn't save it. I think I'm affected by this bug: https://bugs.launchpad.net/ubuntu/+source/network-manager-applet/+bug/1324800 – Farid Nouri Neshat Aug 02 '17 at 10:17
-
@FaridNouriNeshat: It is a while (after an update) in 16.04.1 LTS it doesn't work (I have reported the bug). Now using terminal to do that just read my comment on question about DNS leak. – Xaqron Aug 02 '17 at 11:30
-
This worked for me but wouldn't allow me to connect outside the VPN while it was on. Using the CLI tool worked flawlessly. – absynce Jun 06 '19 at 15:40
-
-
This should be the accepted answer if you ask me. This worked great and took 3 seconds VS me stumbling around with anything else. – Hellreaver May 21 '23 at 16:57
As Louis has explained installing openvpn client can be done with command
sudo apt-get install openvpn
However if you are using dual authentication mechanism for your vpn server, simple connection with
sudo openvpn --config /path/to/config.ovpn
will not be sufficient. You need some extra setup.
- Make sure your config file has
auth-user-passline. Next add
--auth-retry interactto your connection command. So your entire command would look likesudo openvpn --config /path/to/config.ovpn --auth-retry interact
- 4,227
- 3
- 25
- 24
-
1Doesn't cut it for me: `SIGUSR1[soft,connection-reset] received, process restarting` – Tomislav Nakic-Alfirevic Sep 18 '18 at 10:26
-
For me it was working fine. But lately I am also getting `SIGUSR1` error. Any leads please? @TomislavNakic-Alfirevic were you able to resolve it. – urvah shabbir Jul 20 '20 at 10:37
I'm coming here from the locked How to setup VPN using an .ovpn file? [duplicate], because I wanted to give an answer to problems of importing *.ovpn files in the GUI, which some users experience.
Just like others, I've made sure to install:
$sudo apt-get install network-manager-openvpn-gnome
However, on Ubuntu 18.04 (had same problem on 16.04), I've not been able to import a *.ovpn file using the GUI (Settings -> Network -> VPN + -> 'Import from file'). I always get:
Cannot import VPN connection
The file "foo.ovpn" could not be read or does not contain recognized VPN connection information
Error: the plugin does not support import capabilities
However, I just stumbled upon the following instruction from nixCraft for importing a *.opvn file:
$ sudo nmcli connection import type openvpn file /path/to/foo.ovpn
After running that command, my VPN connection gets listed under 'Settings -> Network -> VPN'. After editing the password, my VPN connection works. The VPN connection is also listed in top-panel menu that shows connections, power, users among other things.
- 251
- 2
- 6
-
1This capability also works in the gui nm-connection-editor. Run the program, click [+] and choose Import a saved VPN configuration. The gnome network settings interface for doing this is broken in 18.04, but the nm-connection-editor works nicely. – Steeve McCauley Oct 07 '18 at 12:23
-
Some OpenVPN servers generate config files that the openvpn-gnome import feature has problems with. The *.ovpn file can be edited, so if this happens, simply edit the ovpn file to fix whatever is wrong in there. – LifeBoy Jan 07 '20 at 12:14
-
"fix whatever is wrong there" What would that be? I've read another similar post at mint forum and no one was able to figure out what to "fix". The openvpn cli command opens the opvn file fine it's this package that is mangling the parsing of the ovpn file. What would be helpful is to know exactly what. Randomly changing settings (advanced too) has been a monty pythons complete waste of time – DKebler Apr 14 '20 at 15:10
-
as follow up to my comment above I suspect the issue is that nm gnome doesn't support SHA3. My ovpn file as a `auth SHA3-512` line but the security HMAC doesn't have that choice just the older `SHA-1512`. I set that and at least the connection starts but does not complete. – DKebler Apr 14 '20 at 15:20
Install OpenVpn
sudo apt-get install network-manager-openvpn-gnome
Then go to Network Settings > Edit Connection > Add > Select VPN Point to Point Tunneling Protocol > Create
Add Username, Password and Gateway
Then go to Advanced Menu
Check Use point to point Encryption
Save
Then go to Network Settings > VPN Connection and select that VPN connection and connect it.
- 69,223
- 56
- 216
- 327
- 4,665
- 1
- 9
- 9
If you don't want to involve Network Manager, this git repository has a simple script that does the whole job very well using an interactive session with less than half-a dozen questions. See docs in download.
- 3,814
- 7
- 39
- 75
On Ubuntu 18, install network manager with the command:
sudo apt-get install network-manager-openvpn-gnome
Then...
- Reopen Network settings
- Retry importing file
The import should work fine.
- 111
- 4
-
Welcome to Ask Ubuntu. How is your answer different form the second most up-voted answer above? Or are you trying to comment on another answer? – user68186 Aug 09 '19 at 20:16
-
This is a superfluous answer, a duplicate and doesn't provide a solution. Simply saying: do this, then that, it should work fine, when the original poster says it doesn't, is not helpful – LifeBoy Jan 07 '20 at 12:16
