openvpn
networkLinux/Unix/Windows
The openvpn command is one of the most frequently used commands in Linux/Unix-like operating systems. openvpn Secure Virtual Private Network daemon
Quick Reference
Command Name:
openvpn
Category:
network
Platform:
Linux/Unix/Windows
Basic Usage:
openvpn [options] [arguments]
Common Use Cases
Syntax
openvpn [options] [config_file]
Options
Option | Description |
---|---|
--config file |
Load configuration options from file |
--daemon [name] |
Run as daemon after initialization |
--cd dir |
Change directory to dir before reading files |
--remote host [port] [proto] |
Remote host name or IP address |
--dev device |
TUN/TAP device (tun0, tun1, etc.) |
--proto protocol |
Use protocol (udp, tcp-client, tcp-server) |
--port port |
TCP/UDP port number |
--auth-user-pass [file] |
Authenticate using username/password from file or prompt |
--ca file |
Certificate authority file |
--cert file |
Local certificate file |
--key file |
Local private key file |
--cipher algorithm |
Specify cipher algorithm (e.g., AES-256-CBC) |
--compress [algorithm] |
Enable compression |
--ifconfig l rn |
Set TUN/TAP adapter parameters |
--verb level |
Set output verbosity (0-11, default=1) |
--status file [n] |
Write status to file, updated every n seconds |
--log file |
Output log to file |
--route network [netmask] [gateway] [metric] |
Add route to routing table after connection |
--redirect-gateway [flags] |
Automatically execute routing commands to redirect all traffic through VPN |
--server network netmask |
Configure server mode |
--client |
Configure client mode |
--mktun |
Create a TUN/TAP device |
--rmtun |
Remove a TUN/TAP device |
--genkey secret file |
Generate a random key to file |
--secret file [direction] |
Enable static key encryption mode |
--ping n |
Ping remote every n seconds |
--ping-restart n |
Restart after n seconds pass without reception of a ping |
--persist-key |
Don't re-read key files on restart |
--persist-tun |
Don't close/reopen TUN/TAP device on restart |
Examples
How to Use These Examples
The examples below show common ways to use the openvpn
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
# Basic Examples Basic
sudo openvpn --config client.ovpn