# OpenVPN `systemd` use

This is only a *brief* summary of OpenVPN `systemd` usage.

**Source** https://github.com/OpenVPN/openvpn/blob/master/distro/systemd/README.systemd


## Verify OpenVPN `systemd` support

```
$ openvpn --version
```
   Required FLAG `enable_systemd=yes` - This FLAG **must** be listed to continue.

## 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@.service`
```
$ sudo systemctl start openvpn-server@{Server-config}
```
   Replace `{Server-config}` with the `name` of your config file without the `.conf`
**Client**

   * Place your client configuration file in `/etc/openvpn/client`
   * Use the `openvpn-client@.service`
```
$ sudo systemctl start openvpn-client@{Client-config}
```
   Replace `{Client-config}` with the `name` of your config file without the `.conf`

### Start at boot
   

   Replace `$ systemctl start ...` with `$ systemctl enable ...`

## Interrogate `systemd`

Show current `systemd-daemon` state
```
$ sudo systemctl
```

Show status for Openvpn
```
$ systemctl status openvpn-server@{Server-config}
```

### Use `journalctl`

For a running server
```
$ journalctl -u openvpn-server@{Server-config}
```
   To use `systemd-journald` Openvpn must **not** use `--log`/`--log-append`. Instead the log is redirected to `journald`.


## Notes

* `openvpn@.service` is **deprecated**.
* `openvpn.service` is **obsoleted**. (This is only used for backward compatibility)

## Known issues

* https://community.openvpn.net/openvpn/ticket/945 
* https://community.openvpn.net/openvpn/ticket/1089
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9