? Article 6: How to Install & Configure OpenVPN Client on Ubuntu 22.04 LTS

???? Part A: Preparation

You will need:

  • A system running Ubuntu 22.04 LTS.

  • An .ovpn configuration file (provided by your IT/security team or VPN admin).

  • Internet connection.

???? Hint: The .ovpn file contains server details, certificates, and keys. Sometimes extra files (ca.crt, client.crt, client.key, ta.key) are given separately.

 


 

???? Part B: Install OpenVPN

  1. Update system:

sudo apt update && sudo apt upgrade -y

 

  1. Install OpenVPN:

sudo apt install openvpn -y

 

  1. Confirm installation:

openvpn --version

 

✅ Should display version info.

 


 

???? Part C: Connect using .ovpn file

  1. Place your .ovpn file in /etc/openvpn/:

sudo cp /path/to/file.ovpn /etc/openvpn/client.conf

 

???? Rename file to client.conf so OpenVPN service can use it.

  1. Start OpenVPN with config:

sudo systemctl start openvpn@client

 

  1. Enable auto-start on boot:

sudo systemctl enable openvpn@client

 

  1. Check status:

sudo systemctl status openvpn@client

 

 


 

???? Part D: Manual Test Connection

If you just want to test without enabling as a service:

sudo openvpn --config /path/to/file.ovpn

 

  • You will see logs in the terminal.

  • Keep terminal open while connected.

  • Press Ctrl + C to disconnect.

 


 

???? Part E: Network Manager (GUI method)

For end users who prefer a click-based setup:

  1. Install plugin:

sudo apt install network-manager-openvpn -y

 

  1. Restart Network Manager:

sudo systemctl restart NetworkManager

 

  1. Open Settings → Network → VPN → Add.

  2. Choose Import from file… → select your .ovpn file.

  3. Enter username/password if required.

  4. Save → Turn VPN switch ON.
    ✅ VPN connected.

 


 

???? Part F: Verify VPN Connection

  1. Check your IP:

curl ifconfig.me

 

  • Should show VPN’s IP, not your local ISP.

  1. Ping test:

ping -c 4 google.com

 

✅ If replies come, VPN is working.

 


 

???? Part G: Handling Separate Certificate Files

If instead of one .ovpn, you receive separate files:

  • ca.crt → Certificate Authority

  • client.crt → Client Certificate

  • client.key → Private Key

  • ta.key → TLS Auth key

Edit the .ovpn file with:

ca /etc/openvpn/ca.crt

cert /etc/openvpn/client.crt

key /etc/openvpn/client.key

tls-auth /etc/openvpn/ta.key 1

 

Then copy all files to /etc/openvpn/ and restart OpenVPN.

 


 

???? Part H: Common Errors & Fixes

  • “Cannot load certificate/key” → Ensure correct file paths in .ovpn.

  • “AUTH failed” → Wrong username/password; check with VPN admin.

No Internet after connecting → DNS not pushed by server → add:

dhcp-option DNS 8.8.8.8

  •  inside .ovpn.

  • Service won’t start → Run manual test (sudo openvpn --config client.ovpn) to see detailed error.

 


 

General Hints ????

  • Keep a backup of your .ovpn file in a safe folder.

  • If VPN drops frequently, check firewall or ISP blocking UDP; try switching to TCP in config.

  • To stop auto-start VPN at boot:

sudo systemctl disable openvpn@client

 

  • For GUI users: always install network-manager-openvpn for smoother experience.

 


 

✅ You now have OpenVPN client installed and working on Ubuntu 22.04.