openvpn-client
OpenVPN systemd use
This is only a brief summary of OpenVPN systemd usage.
OpenVPN must be compiled with systemd support.
Use the correct OpenVPN supported systemd
.servicefiles.
Build OpenVPN with systemd support
When you build the openvpn binary use the configure option --enable-systemd like so:
./configure --enable-systemd
Verify OpenVPN systemd support has been enabled like so:
$ openvpn --version
Look for
enable-systemd=yesin the output.
Using OpenVPN with systemd support
In order to use OpenVPN with systemd please use the correct systemd .service file.
Server:
- Place your server configuration file in
/etc/openvpn/server - Use the
openvpn-server@.servicelike so:$ sudo systemctl start openvpn-server@{Server-config} Replace{Server-config}with thenameof your config file without the.conf
Client:
- Place your client configuration file in
/etc/openvpn/client(notice however that, due to an outdated version of openvpn, some distributions, like Ubuntu 20.10, look for configuration files under/etc/openvpninstead of/etc/openvpn/client. In case of doubt, check the specific error message injournalctl -xe) - The filename must end in
.conf, so if your client config file is something likeprofile.ovpnrename it tosomename.conf(wheresomenameis meaningful to you, to describe where you are connecting.) - Use the
openvpn-client@.servicelike so:$ sudo systemctl start openvpn-client@{Client-config} Replace{Client-config}with thenameof your config file without the.conf
Start at boot:
Replace
startwithenable
Other systemd questions are probably best answered by reading man systemctl etc ..
