我试图在Ubuntu18.04位上安装wireguard,下面是视频教程之一。
步骤systemctl start wg-quick@wg0.service
以
Job for wg-quick@wg0.service failed because the control process exited with error code.
See "systemctl status wg-quick@wg0.service" and "journalctl -xe" for details.
运行systemctl status wg-quick@wg0.service
提供:
● wg-quick@wg0.service - WireGuard via wg-quick(8) for wg0
Loaded: loaded (/lib/systemd/system/wg-quick@.service; indirect; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2023-03-11 00:02:48 UTC; 7min 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: 18984 ExecStart=/usr/bin/wg-quick up wg0 (code=exited, status=1/FAILURE)
Main PID: 18984 (code=exited, status=1/FAILURE)
Mar 11 00:02:48 my-vps.name systemd[1]: Starting WireGuard via wg-quick(8) for wg0...
Mar 11 00:02:48 my-vps.name wg-quick[18984]: [#] ip link add wg0 type wireguard
Mar 11 00:02:48 my-vps.name wg-quick[18984]: RTNETLINK answers: Operation not supported
Mar 11 00:02:48 my-vps.name wg-quick[18984]: Unable to access interface: Protocol not supported
Mar 11 00:02:48 my-vps.name wg-quick[18984]: [#] ip link delete dev wg0
Mar 11 00:02:48 my-vps.name wg-quick[18984]: Cannot find device "wg0"
Mar 11 00:02:48 my-vps.name systemd[1]: wg-quick@wg0.service: Main process exited, code=exited, status=1/FAILURE
Mar 11 00:02:48 my-vps.name systemd[1]: wg-quick@wg0.service: Failed with result 'exit-code'.
Mar 11 00:02:48 my-vps.name systemd[1]: Failed to start WireGuard via wg-quick(8) for wg0.
运行journalctl -xe
显示:
Mar 10 23:46:27 my-vps.name wg-quick[18951]: [#] ip link add wg0 type wireguard
Mar 10 23:46:27 my-vps.name wg-quick[18951]: RTNETLINK answers: Operation not supported
Mar 10 23:46:27 my-vps.name wg-quick[18951]: Unable to access interface: Protocol not supported
Mar 10 23:46:27 my-vps.name wg-quick[18951]: [#] ip link delete dev wg0
Mar 10 23:46:27 my-vps.name wg-quick[18951]: Cannot find device "wg0"
我的wg0.conf
看起来像:
[Interface]
PrivateKey = myprivatekeyhere
Address = 10.0.0.1/24
ListenPort = 51830
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -o venet0 -j MASQUERADE
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -o venet0 -j MASQUERADE
modprobe wireguard
说:
modprobe: FATAL: Module wireguard not found in directory /lib/modules/4.15.0
ls /lib/modules
返回:
4.15.0 4.15.0-206-generic
uname -r
显示:
4.15.0
重新启动并没有帮助。搜索没有帮助。
发布于 2023-03-11 13:53:29
因此,是的,正如错误所述:您没有内核的wireguard模块,因此无法执行wireguard。
您需要构建并安装wireguard模块(因为您使用的是非常老的发行版,内核是旧的,所以没有内核内的wireguard,您需要单独安装它;如果启用了宇宙恢复功能,请安装wireguard-dkms
。更好的是,更新到一个更现代的Ubuntu;从那时起已经有了两个长期的支持版本。Linux内核> 5.6的任何内容都可能包含了wireguard模块;因此,可以使用Ubuntu22.04)
https://unix.stackexchange.com/questions/739376
复制相似问题