Blame

613626 Samuli Seppänen 2025-02-27 12:52:06 1
# OpenVPN `systemd` use
2
3
This is only a *brief* summary of OpenVPN `systemd` usage.
4
5
**Source** https://github.com/OpenVPN/openvpn/blob/master/distro/systemd/README.systemd
6
7
8
## Verify OpenVPN `systemd` support
9
10
```
11
$ openvpn --version
12
```
13
Required FLAG `enable_systemd=yes` - This FLAG **must** be listed to continue.
14
15
## Using OpenVPN with `systemd` support
16
17
In order to use OpenVPN with `systemd` please use the correct `systemd` `.service` file.
18
19
**Server**
20
21
* Place your server configuration file in `/etc/openvpn/server`
22
* Use the `openvpn-server@.service`
23
```
24
$ sudo systemctl start openvpn-server@{Server-config}
25
```
26
Replace `{Server-config}` with the `name` of your config file without the `.conf`
27
**Client**
28
29
* Place your client configuration file in `/etc/openvpn/client`
30
* Use the `openvpn-client@.service`
31
```
32
$ sudo systemctl start openvpn-client@{Client-config}
33
```
34
Replace `{Client-config}` with the `name` of your config file without the `.conf`
35
36
### Start at boot
37
38
39
Replace `$ systemctl start ...` with `$ systemctl enable ...`
40
41
## Interrogate `systemd`
42
43
Show current `systemd-daemon` state
44
```
45
$ sudo systemctl
46
```
47
48
Show status for Openvpn
49
```
50
$ systemctl status openvpn-server@{Server-config}
51
```
52
53
### Use `journalctl`
54
55
For a running server
56
```
57
$ journalctl -u openvpn-server@{Server-config}
58
```
59
To use `systemd-journald` Openvpn must **not** use `--log`/`--log-append`. Instead the log is redirected to `journald`.
60
61
62
## Notes
63
64
* `openvpn@.service` is **deprecated**.
65
* `openvpn.service` is **obsoleted**. (This is only used for backward compatibility)
66
67
## Known issues
68
69
* https://community.openvpn.net/openvpn/ticket/945
70
* https://community.openvpn.net/openvpn/ticket/1089