WireGuard의 도움으로 내 서버에 VPN을 설정하려고 합니다. 나는 이 튜토리얼을 따르고 있다https://upcloud.com/resources/tutorials/get-started-wireguard-vpn
조치를 취한 후 이 오류가 발생했습니다.
systemctl status wg-quick@wg0
× [email protected] - WireGuard via wg-quick(8) for wg0
Loaded: loaded (/lib/systemd/system/[email protected]; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2023-07-17 08:31:15 UTC; 15h 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
Main PID: 5700 (code=exited, status=1/FAILURE)
CPU: 5ms
Jul 17 08:31:15 v1567418.hosted-by-vdsina.ru systemd[1]: Starting WireGuard via wg-quick(8) for wg0...
Jul 17 08:31:15 v1567418.hosted-by-vdsina.ru wg-quick[5700]: wg-quick: `/etc/wireguard/wg0.conf' does not exist
Jul 17 08:31:15 v1567418.hosted-by-vdsina.ru systemd[1]: [email protected]: Main process exited, code=exited, status=1/FAILURE
Jul 17 08:31:15 v1567418.hosted-by-vdsina.ru systemd[1]: [email protected]: Failed with result 'exit-code'.
Jul 17 08:31:15 v1567418.hosted-by-vdsina.ru systemd[1]: Failed to start WireGuard via wg-quick(8) for wg0.
내 행동:
sudo nano /etc/sysctl.conf 파일에서 주석 처리되지 않은 행
net.ipv4.ip_forward=1
다음 변경사항을 적용하세요.
sudo sysctl -p
/etc/wireguard/wg0.conf 구성
[Interface]
Address = 10.66.66.1/24,fd42:42:42::1/64
ListenPort = 58723
PrivateKey = XXXXX
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE;ip6tables -A FORWARD -i %i -j ACCEPT; ip6tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE;
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE;ip6tables -D FORWARD -i %i -j ACCEPT; ip6tables -t nat -D POSTROUTING -o eth0 -j MASQUERADE;
[Peer]
# Client Name: Unnamed
PublicKey = MY__PUB_KEY
AllowedIPs = 10.66.66.2/32,fd42:42:42::2/128
그러다가 WG를 시작했어요
> wg-quick up wg0
wg-quick: `wg0' already exists
그런 다음 WG 자동 시작을 활성화합니다.
systemctl enable wg-quick@wg0
유용한 정보
ls /etc/wireguard
wg0.conf
# /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
안녕하세요, 비슷한 문제에 직면했습니다. 결국 양성자로 설정했습니다. https://protonvpn.com/support/wireguard-manual-linux/