Skip to content

Instantly share code, notes, and snippets.

@HuakunShen
Last active December 28, 2023 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save HuakunShen/b2b7169222c2c0658760777505e9eef4 to your computer and use it in GitHub Desktop.
Save HuakunShen/b2b7169222c2c0658760777505e9eef4 to your computer and use it in GitHub Desktop.
openvpn3 Usage

openvpn3 Usage

Install openvpn3 from this website.

If you look at the man page of openvpn3, there are 2 main concepts:

  1. config: a configuration of vpn where you connects to
  2. session: a vpn session

Config

Suppose you have a configuration file called vpn.ovpn that’s connecting to a server in New York.

openvpn3 config-import —-config vpn.ovpn    # import a vpn configuration
openvpn3 configs-list                       # list all imported configurations

The vpn config name is called vpn.ovpn. If you have multiple openvpn files with the same filename, the imported config will have duplicate name, and cannot start a new session. In this case, it’s better to rename a config every time a config file is imported.

openvpn3 config-manage --config vpn.ovpn --rename new-york    # rename a vpn config

To remove a openvpn config

openvpn3 config-remove --config new-york  # remove with config name
openvpn3 config-remove --path /net/openvpn/v3/configuration/xxxx  # remove with config path, find this with configs-list

Session

# connect
openvpn3 session-start --config vpn.ovpn                  # start a vpn session with a file
openvpn3 session-manage --disconnect --config vpn.ovpn    # disconnect session with a ovpn file

# disconnect
openvpn3 session-start --config new-york                  # start a vpn session with a imported configuration
openvpn3 session-manage --disconnect --config new-york    # disconnect session with import config name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment