OpenVPN3 quick usage
OpenVPN3 Client Quick Usage Guide
A streamlined guide to get your VPN tunnel up and running in minutes.
OpenVPN3 is the next-generation command-line client for managing OpenVPN connections on Linux systems. It offers a more unified and user-friendly interface compared to the classic openvpn client, with better session management and system integration.
This guide focuses on using the OpenVPN3 client on Ubuntu 24.04.
1. Installing OpenVPN3
1.1 Add the Official Repository
Install the OpenVPN repository key used by the OpenVPN 3 Linux packages:
1 | |
Add the proper repository for Ubuntu 24.04 (Noble):
1 | |
1.2 Install OpenVPN3
Update package lists and install:
1 | |
2. Configuration Setup
Before starting a connection, you’ll need your VPN provider’s configuration file (usually a .ovpn or .conf file) along with your username and password.
Tip: Create a dedicated folder, such as ~/openvpn, to organize these files.
2.1 Create a Credential File
To avoid entering credentials manually each time, create a secure credential file:
1 | |
Add your username and password (each on a separate line):
1 | |
Set appropriate permissions:
1 | |
2.2 Modify the Configuration File
Edit your .ovpn file to reference the credential file:
1 | |
Locate the auth-user-pass line and modify it to use an absolute path:
1 | |
Important: Always use absolute paths; relative paths like ~/credential won’t work.
2.3 Import the Configuration
Import your configuration with a persistent profile name:
1 | |
--config: Path to your.ovpnfile--name: A unique profile identifier (e.g.,myvpn) for connection management--persistent: Ensures the profile persists across system reboots
2.4 Enable Compression (Optional)
To potentially improve performance on slower connections:
1 | |
3. Connection Management
3.1 Start a VPN Connection
Establish a VPN session:
1 | |
The connection will run in the foreground. To run it as a background daemon instead:
1 | |
3.2 Create Command Aliases (Optional)
Add these aliases to your ~/.bashrc file for convenience:
1 | |
Reload your configuration and use the shortcuts:
1 | |
3.3 Monitor Active Sessions
Check current VPN connections:
1 | |
This displays session details including unique identifiers and connection timestamps.
4. Additional Commands
| Action | Command |
|---|---|
| List imported profiles | openvpn3 configs-list |
| Remove a configuration | openvpn3 config-remove --config myvpn |
Reference
- https://openvpn.net/cloud-docs/tutorials/configuration-tutorials/connectors/operating-systems/linux/tutorial--learn-to-install-and-control-the-openvpn-3-client.html
- https://datmt.com/backend/setup-and-connect-to-vpn-using-openvpn-client-on-ubuntu/#:~:text=You%20will%20be%20prompted%20to,the%20config%20names%20and%20path.
- Deepseek