Skip to main content

Connecting to OpenVPN Using NetworkManager

Install the required packages

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

Creating individual files from client.ovpn file

These files must be kept safe and private at all times

  1. Make a directory called openvpn in your home directory
  2. Copy the client.ovpn file into dir openvpn
  3. Optional: Keep an original copy of the file – call it client.ovpn.orig
  4. Next we will create 4 files under the openvpn directory. Open the client.ovpn file in a text editor
  5. Create a file called ca.crt – copy the text between and from client.ovpn into this file
  6. Create a file called client.crt – copy the text between and from client.ovpn into this file
  7. Create a file called client.key – copy the text between and from client.ovpn into this file
  8. Create a file called ta.key – copy the text between and from client.ovpn into this file
  9. At this point i have a total of 6 files under my openvpn directory

Modify the client.ovpn file

Just before the ## —–BEGIN RSA SIGNATURE—– line add the below lines and save:

ca ca.crt
cert client.crt
key client.key
tls-auth ta.key

Setting up the Network Manager

  1. Click on Ubuntu network icon on the top right
  2. Select VPN Connections -> Configure VPN ( the Network Connections window will open )
  3. Click on the VPN tab and click Import
  4. Select the client.ovpn file we just modified and it should automatically import some things into the next screen
  5. Connection Name will be = client – change this to something meaningful ( i set it to companyVPN )
  6. Gateway must be imported already
  7. Type is : Password with Certificates ( TLS ) – this was also set for me
  8. Provide the username and password for VPN
  9. User certificate will be client.crt
  10. CA certificate will be ca.crt
  11. Private Key will be client.key
  12. Click on Advanced -> TLS Authentication Tab
  13. Key file will be ta.key
  14. Key Direction must be set based on the key direction in your client.ovpn file
  15. Open the client.ovpn file and search for “key-direction” and note the number after that ( mine is key-direction 1 )
  16. Put this number in the Key Direction field in the TLS Authentication Tab
  17. Click save on all windows and close all windows.

Time to test connection

  1. Click on network icon on the top right
  2. Select VPN Connections and you should see your connection there – click it
  3. If successfully connected, you will see a message and then you can verify your IP address with ifconfig
  4. There is a Disconnect VPN under VPN Connection for obvious reasons