diff --git a/README.md b/README.md index 58eaff6..22cf8db 100644 --- a/README.md +++ b/README.md @@ -34,3 +34,5 @@ Or connect a container to it. podman run -it --rm --network ns:/var/run/netns/my-vpn alpine wget -O - https://ipinfo.io ~~~ +You can find a `wg-quick@.service` equivalent at [extras/systemd/wg-netns@.service](./extras/systemd/wg-netns@.service). + diff --git a/extras/systemd/wg-netns@.service b/extras/systemd/wg-netns@.service new file mode 100644 index 0000000..0509a06 --- /dev/null +++ b/extras/systemd/wg-netns@.service @@ -0,0 +1,16 @@ +[Unit] +Description=WireGuard Network Namespace (%i) +Wants=network-online.target nss-lookup.target +After=network-online.target nss-lookup.target + +[Service] +Type=oneshot +RemainAfterExit=yes + +Environment=WG_ENDPOINT_RESOLUTION_RETRIES=infinity +ExecStart=wg-netns up %i +ExecStop=wg-netns down %i + +[Install] +WantedBy=multi-user.target +