Wireguard 서비스는 시작 시 "비활성(죽음)" 상태입니다.

Wireguard 서비스는 시작 시 "비활성(죽음)" 상태입니다.

시스템에 설치된 Wireguard를 사용하여 Ubuntu 21.04를 실행하는 Raspberry Pi 4가 있습니다. 부팅 시 올바르게 시작되지 않습니다. 이전에 Ubuntu 20.10을 설치했는데 동일한 상황이 발생했습니다.

시작에:

$ systemctl status [email protected][email protected] - WireGuard via wg-quick(8) for wg0
     Loaded: loaded (/lib/systemd/system/[email protected]; disabled; vendor preset: enabled)
     Active: inactive (dead)
       Docs: man:wg-quick(8)
             man:wg(8)
             https://www.wireguard.com/
             https://www.wireguard.com/quickstart/
             https://git.zx2c4.com/wireguard-tools/about/src/man/wg-quick.8
             https://git.zx2c4.com/wireguard-tools/about/src/man/wg.8

실행 중인 시스템에서:

$ systemctl start [email protected]

$ systemctl status [email protected][email protected] - WireGuard via wg-quick(8) for wg0
     Loaded: loaded (/lib/systemd/system/[email protected]; disabled; vendor preset: enabled)
     Active: active (exited) since Wed 2021-06-09 12:52:16 PDT; 2s ago
       Docs: man:wg-quick(8)
             man:wg(8)
             https://www.wireguard.com/
             https://www.wireguard.com/quickstart/
             https://git.zx2c4.com/wireguard-tools/about/src/man/wg-quick.8
             https://git.zx2c4.com/wireguard-tools/about/src/man/wg.8
    Process: 2366 ExecStart=/usr/bin/wg-quick up wg0 (code=exited, status=0/SUCCESS)
   Main PID: 2366 (code=exited, status=0/SUCCESS)

Jun 09 12:52:15 pi4 systemd[1]: Starting WireGuard via wg-quick(8) for wg0...
Jun 09 12:52:15 pi4 wg-quick[2366]: [#] ip link add wg0 type wireguard
Jun 09 12:52:16 pi4 wg-quick[2366]: [#] wg setconf wg0 /dev/fd/63
Jun 09 12:52:16 pi4 wg-quick[2366]: [#] ip -4 address add 10.9.0.1/24 dev wg0
Jun 09 12:52:16 pi4 wg-quick[2366]: [#] ip link set mtu 1420 up dev wg0
Jun 09 12:52:16 pi4 wg-quick[2366]: [#] iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
Jun 09 12:52:16 pi4 wg-quick[2366]: [#] ip6tables -A FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
Jun 09 12:52:16 pi4 systemd[1]: Finished WireGuard via wg-quick(8) for wg0.

$ cat /lib/systemd/system/[email protected]
[Unit]
Description=WireGuard via wg-quick(8) for %I
After=network-online.target nss-lookup.target
Wants=network-online.target nss-lookup.target
PartOf=wg-quick.target
Documentation=man:wg-quick(8)
Documentation=man:wg(8)
Documentation=https://www.wireguard.com/
Documentation=https://www.wireguard.com/quickstart/
Documentation=https://git.zx2c4.com/wireguard-tools/about/src/man/wg-quick.8
Documentation=https://git.zx2c4.com/wireguard-tools/about/src/man/wg.8

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/wg-quick up %i
ExecStop=/usr/bin/wg-quick down %i
ExecReload=/bin/bash -c 'exec /usr/bin/wg syncconf %i <(exec /usr/bin/wg-quick strip %i)'
Environment=WG_ENDPOINT_RESOLUTION_RETRIES=infinity

[Install]
WantedBy=multi-user.target

답변1

서비스가 비활성화된 것 같습니다.

$ systemctl status [email protected][email protected] - WireGuard via wg-quick(8) for wg0
     Loaded: loaded (/lib/systemd/system/[email protected]; disabled; vendor preset: enabled)
                                                            ^^^^^^^^-- here

...활성화:

sudo systemctl enable [email protected]

관련 정보