wg0.service
· 573 B · SYSTEMD
原始檔案
## Connect to Wireguard interface automatically
## using NetworkManager.
## wg-quick@ -systemd services do not configure
## DNS properly when systemd-resolved is used
## resulting in DNS leaks and general issues,
## hence starting the interface via nmcli is
## necessary
[Unit]
Description=wg0 interface
After=network-online.target
Wants=network-online.target
[Service]
Type=oneshot
ExecStart=nmcli conn up wg0
ExecStartPost=resolvectl flush-caches
ExecStop=nmcli conn down wg0
ExecStopPost=resolvectl flush-caches
RemainAfterExit=true
[Install]
WantedBy=default.target
1 | ## Connect to Wireguard interface automatically |
2 | ## using NetworkManager. |
3 | ## wg-quick@ -systemd services do not configure |
4 | ## DNS properly when systemd-resolved is used |
5 | ## resulting in DNS leaks and general issues, |
6 | ## hence starting the interface via nmcli is |
7 | ## necessary |
8 | |
9 | [Unit] |
10 | Description=wg0 interface |
11 | After=network-online.target |
12 | Wants=network-online.target |
13 | |
14 | [Service] |
15 | Type=oneshot |
16 | ExecStart=nmcli conn up wg0 |
17 | ExecStartPost=resolvectl flush-caches |
18 | ExecStop=nmcli conn down wg0 |
19 | ExecStopPost=resolvectl flush-caches |
20 | RemainAfterExit=true |
21 | |
22 | [Install] |
23 | WantedBy=default.target |