| 1 | = OpenVPN systemd use |
| 2 | |
| 3 | This is only a ''brief'' summary of OpenVPN systemd usage. |
| 4 | |
| 5 | OpenVPN **must** be compiled with systemd support.[[br]] |
| 6 | |
| 7 | Use the correct OpenVPN supported systemd `.service` files. |
| 8 | |
| 9 | === Build OpenVPN with systemd support |
| 10 | |
| 11 | When you build the openvpn binary use the configure option `--enable-systemd` like so: |
| 12 | |
| 13 | {{{ |
| 14 | ./configure --enable-systemd |
| 15 | }}} |
| 16 | |
| 17 | Verify OpenVPN systemd support has been enabled like so: |
| 18 | |
| 19 | {{{ |
| 20 | $ openvpn --version |
| 21 | }}} |
| 22 | Look for `enable-systemd=yes` in the output. |
| 23 | |
| 24 | === Using OpenVPN with systemd support |
| 25 | |
| 26 | In order to use OpenVPN with systemd please use the correct systemd `.service` file. |
| 27 | |
| 28 | **Server**: |
| 29 | |
| 30 | * Place your server configuration file in `/etc/openvpn/server` |
| 31 | * Use the `openvpn-server@.service` like so: |
| 32 | {{{ |
| 33 | $ sudo systemctl start openvpn-server@{Server-config} |
| 34 | }}} |
| 35 | Replace `{Server-config}` with the `name` of your config file without the `.conf` |
| 36 | **Client**: |
| 37 | |
| 38 | * Place your client configuration file in `/etc/openvpn/client` |
| 39 | * Use the `openvpn-client@.service` like so: |
| 40 | {{{ |
| 41 | $ sudo systemctl start openvpn-client@{Client-config} |
| 42 | }}} |
| 43 | Replace `{Client-config}` with the `name` of your config file without the `.conf` |
| 44 | |
| 45 | **Start at boot**: |
| 46 | |
| 47 | Replace `start` with `enable` |
| 48 | |
| 49 | Other systemd questions are probably best answered by reading `man systemd` |
| 50 | |
| 51 | **Note**: |
| 52 | |
| 53 | * `openvpn@.service` is **deprecated**. |
| 54 | * `openvpn.service` is **obsoleted**. (This is only used for backward compatibility) |
| 55 | |
| 56 | === Known issues |
| 57 | |
| 58 | https://community.openvpn.net/openvpn/ticket/945 [[br]] |
| 59 | https://community.openvpn.net/openvpn/ticket/1089 |