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
- Make a directory called openvpn in your home directory
- Copy the client.ovpn file into dir openvpn
- Optional: Keep an original copy of the file – call it client.ovpn.orig
- Next we will create 4 files under the openvpn directory. Open the client.ovpn file in a text editor
- Create a file called ca.crt – copy the text between and from client.ovpn into this file
- Create a file called client.crt – copy the text between and from client.ovpn into this file
- Create a file called client.key – copy the text between and from client.ovpn into this file
- Create a file called ta.key – copy the text between and from client.ovpn into this file
- 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
- Click on Ubuntu network icon on the top right
- Select VPN Connections -> Configure VPN ( the Network Connections window will open )
- Click on the VPN tab and click Import
- Select the client.ovpn file we just modified and it should automatically import some things into the next screen
- Connection Name will be = client – change this to something meaningful ( i set it to companyVPN )
- Gateway must be imported already
- Type is : Password with Certificates ( TLS ) – this was also set for me
- Provide the username and password for VPN
- User certificate will be client.crt
- CA certificate will be ca.crt
- Private Key will be client.key
- Click on Advanced -> TLS Authentication Tab
- Key file will be ta.key
- Key Direction must be set based on the key direction in your client.ovpn file
- Open the client.ovpn file and search for “key-direction” and note the number after that ( mine is key-direction 1 )
- Put this number in the Key Direction field in the TLS Authentication Tab
- Click save on all windows and close all windows.
Time to test connection
- Click on network icon on the top right
- Select VPN Connections and you should see your connection there – click it
- If successfully connected, you will see a message and then you can verify your IP address with ifconfig
- There is a Disconnect VPN under VPN Connection for obvious reasons