You can run into trouble importing an .ovpn
config file in Ubuntu, while the same file is imported without any problem in Android.
Somehow when there are unknown or not-supported sections in the config file, importing in Ubuntu will fail with this rather obscure error:
The file
'vpn.ovpn'
could not be read or does not contain recognized VPN connection informationError: the plugin does not support import capability.
The solution is to manually edit the openvpn.ovpn
file in a text editor and fix it.
In my case the openvpn.ovpn config
file suffered from 2 problems:
- connections were double defined
- a <dh> tag was includes, which shouldn’t be in a client file
Fixing the openvpn.ovpn file import
Following these steps will fix the import of openvpn.ovpn config files in Ubuntu 16.04 LTS. Open the openvp.ovpn in a text-editor.
- Delete the complete <dh> tag.
- When you have multiple <connection> tags, it won’t import. Remove the TCP connection tag completely:
<connection>
remote <ip> 443 tcp-client
</connection
- The edit the remaining connection tag by removing the surrounding tags, simply unXML it.
<connection>
remote <ip> 1194 udp
</connection>
to
remote <ip> 1194 udp
Save your file and import it.
- Edit connections
- Add
- Scroll down
- Import a saved vpn connection
- create
- Select the edited openvpn.ovpn file
- Done!
Explanation
The Diffie Hellman Parameters are only needed for the server, so this is a bug in the openvpn server that creates the client config file. Still the import script should skip this setting instead of choking on it.
Then the multiple connection issue: Most openvpn servers will accept connections over UPD (preferred setting), but will offer a fallback over TCP when the client is behind a firewall that doesn’t allow UDP. This will happen now and then. The TCP port is the same as the https port, so that port is always open. It seems the network manager doesn’t allow multiple connection setup, although it can use a TCP connection. If you need TCP as a fallback just setup two connections:
- OpenVPN UDP
- OpenVPN TCP
And choose what you need in your network settings, this is probably the best solution. And actually easier then changing method inside the the profile settings, like you should do in Android.
You probably need to replace tcp-client with tcp, and remove the connection tag:
remote <ip> 443 tcp
Happy and safe networking!
October 23rd, 2017 at 2:05 pm
Thanks. Saved my life. After the double connection settings were removed, the file imported fine.
November 17th, 2017 at 4:57 pm
Thanks! Worked for me!
November 19th, 2018 at 10:45 am
You saved my life man! i wish i had seen this earlier i wasted two days of my life trying to get the openvpn working on Linux Mint
January 19th, 2019 at 2:43 pm
Sadly not my case.
Try to use the configs from freeopenvpn.org, which contain certificates and keys. Even removing all tags according to the keys and cas won’t help
Mint 18.3 freshly updated
January 21st, 2019 at 11:07 am
@mclien, what kind of import error do you get?
February 14th, 2019 at 4:20 am
Error same as above at very top of page..