A simple command-line tool for managing OpenVPN connections on Linux systems. This tool provides an easy-to-use interface for starting, stopping, and managing OpenVPN client connections using systemd.
- Start, stop, and restart VPN connections
- Check connection status
- Enable/disable VPN at system boot
- View connection logs in real-time
- List all available VPN configurations
- Color-coded output for better readability
- Linux system with systemd
- OpenVPN installed
- sudo privileges
- OpenVPN configuration files in
/etc/openvpn/client/
- Clone this repository:
git clone <repository-url>
cd vpn-cli- Make the script executable:
chmod +x vpn- (Optional) Create a symbolic link to use the command system-wide:
sudo ln -s $(pwd)/vpn /usr/local/bin/vpnvpn <command> <vpn-name>| Command | Description |
|---|---|
start <name> |
Start OpenVPN connection |
stop <name> |
Stop OpenVPN connection |
restart <name> |
Restart OpenVPN connection |
status <name> |
Show connection status |
enable <name> |
Enable VPN to start at boot |
disable <name> |
Disable VPN from starting at boot |
logs <name> |
Show recent logs (follows log output) |
list |
List all available VPN configurations |
Start a VPN connection:
vpn start abcStop a VPN connection:
vpn stop abcCheck connection status:
vpn status abcView logs in real-time:
vpn logs abcList all available VPN configurations:
vpn listEnable VPN to start automatically at boot:
vpn enable abcPlace your OpenVPN configuration files (.conf) in /etc/openvpn/client/. The VPN name used in commands should match the configuration filename without the .conf extension.
For example, if you have /etc/openvpn/client/myserver.conf, use:
vpn start myserverThis tool is a wrapper around systemd's OpenVPN client service ([email protected]). It translates simple commands into the appropriate systemctl operations, making VPN management more intuitive.
This project is provided as-is for personal and educational use.