Vpn

Server Set Up

Configuration Client File

If you install OpenVPN via an RPM or DEB package on Linux, the installer will set up an initscript. When executed, the initscript will scan for .conf configuration files in /etc/openvpn, and if found, will start up a separate OpenVPN daemon for each file.

The Windows installer will set up a Service Wrapper, but leave it turned off by default. To activate it, go to Control Panel / Administrative Tools / Services, select the OpenVPN service, right-click on properties, and set the Startup Type to Automatic. This will configure the service for automatic start on the next reboot.

When started, the OpenVPN Service Wrapper will scan the \Program Files\OpenVPN\config folder for .ovpn configuration files, starting a separate OpenVPN process on each file.

How to connect the clients

Start OpenVPN by hand on both sides with the following command (verbose output at 6):

openvpn --config /etc/openvpn/tun0.ovpn --verb 6

Starting OpenVPN

Manual startup: To troubleshoot a VPN connection, start the client’s daemon manually with openvpn /etc/openvpn/client/client.conf as root. The server can be started the same way using its own configuration file (e.g., openvpn /etc/openvpn/server/server.conf).

systemd service configuration

To start the OpenVPN server automatically at system boot, sudo sistemctl enable openvpn-server@configuration.service on the applicable machine. For a client, enable openvpn-client@configuration.service instead. (Leave .conf out of the configuration string.)

For example, if the client configuration file is /etc/openvpn/client/client.conf, the service name is openvpn-client@client.service. Or, if the server configuration file is /etc/openvpn/server/server.conf, the service name is openvpn-server@server.service.

# /etc/openvpn/client/configuration.conf
# automatic start
sudo systemctl enable openvpn-client@configuration.service
# manual start
sudo systemctl start openvpn-client@configuration.service

Running in a Windows command prompt window On Windows, you can start OpenVPN by right clicking on an OpenVPN configuration file .ovpn file and selecting “Start OpenVPN on this config file”. Once running in this fashion, several keyboard commands are available:

  • F1 – Conditional restart (doesn’t close/reopen TAP adapter)

  • F2 – Show connection statistics

  • F3 – Hard restart

  • F4 – Exit

  • Running as a Windows Service

When OpenVPN is started as a service on Windows, the only way to control it is: Via the service control manager Control Panel / Administrative Tools / Services which gives start/stop control.Via the management interface.

Tip

If openvpn-client@configuration.service units take a long time to start, it might be the network manager is not triggering the network-online.target systemd target at the right moment. For example, when using systemd-networkd, check that systemd-networkd-wait-online.service is properly configured.


Last update: Nov 20, 2024