wireguard
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| wireguard [2026/08/02 10:11] – baumi | wireguard [2026/08/02 10:15] (current) – baumi | ||
|---|---|---|---|
| Line 45: | Line 45: | ||
| PrivateKey = < | PrivateKey = < | ||
| ListenPort = 51820 | ListenPort = 51820 | ||
| - | #If something needs to happen | + | #If something needs to happen |
| #PostUp = / | #PostUp = / | ||
| #PreDown = / | #PreDown = / | ||
| Line 94: | Line 94: | ||
| persistent keepalive: every 25 seconds | persistent keepalive: every 25 seconds | ||
| </ | </ | ||
| + | |||
| + | ===== Fallback systemd service to call PreDown script ===== | ||
| + | < | ||
| + | root@hostb # cat << EOF > / | ||
| + | [Unit] | ||
| + | Description=WireGuard wg0 shutdown fallback | ||
| + | DefaultDependencies=no | ||
| + | |||
| + | Before=shutdown.target reboot.target halt.target | ||
| + | Before=wg-quick@wg0.service | ||
| + | |||
| + | Conflicts=shutdown.target reboot.target halt.target | ||
| + | |||
| + | After=local-fs.target | ||
| + | |||
| + | [Service] | ||
| + | Type=oneshot | ||
| + | RemainAfterExit=yes | ||
| + | |||
| + | ExecStart=/ | ||
| + | ExecStop=/ | ||
| + | |||
| + | TimeoutStopSec=30 | ||
| + | |||
| + | [Install] | ||
| + | WantedBy=multi-user.target | ||
| + | EOF | ||
| + | root@hostb # systemctl daemon-reload | ||
| + | root@hostb # systemctl enable wg0-shutdown-fallback.service | ||
| + | root@hostb # systemctl start wg0-shutdown-fallback.service | ||
| + | </ | ||
| + | |||
| + | |||
| {{tag>kb linux}} | {{tag>kb linux}} | ||
wireguard.1785658272.txt.gz · Last modified: by baumi
