root@hqdc034:~# wg-quick up wg0 [#] ip link add wg0 type wireguard RTNETLINK answers: Operation not supported Unable to access interface: Protocol not supported [#] ip link delete dev wg0 Cannot find device "wg0" root@hqdc034:~# wg-quick up wg1 [#] ip link add wg1 type wireguard RTNETLINK answers: Operation not supported Unable to access interface: Protocol not supported [#] ip link delete dev wg1 Cannot find device "wg1"
因為很久沒動了,所以wireguard config 檔案應該是沒有問題
不過還是檢查看看?
1 2
root@hqdc034:~# wg showconf wg0 Unable to access interface: Protocol not supported
很好,果然不是config 的問題,看來是wireguard 某些套件有狀況了
用modprobe 檢查一下
1 2
root@hqdc034:~# modprobe wireguard modprobe:FATAL: Module wireguard not found in directory /lib/modules/4.15.0-106-generic
Status: Before uninstall, this moduleversionwasACTIVEonthiskernel.
wireguard.ko: - Uninstallation - Deleting from: /lib/modules/4.15.0-101-generic/updates/dkms/ - Original module - No original modulewasfoundforthismoduleonthiskernel. - Use the dkms install command to reinstall any previous moduleversion.
depmod....
DKMS: uninstall completed.
------------------------------ Deleting moduleversion: 1.0.20200426 completely from the DKMS tree. ------------------------------ Done. Unpacking wireguard-dkms (1.0.20200611-0ppa1~18.04) over (1.0.20200426-0ppa1~18.04) ... 設定 wireguard-dkms (1.0.20200611-0ppa1~18.04) ... Loading new wireguard-1.0.20200611 DKMS files... Building for4.15.0-106-generic Building initial modulefor 4.15.0-106-generic Done.
wireguard: Running moduleversionsanitycheck. - Original module - No original moduleexistswithinthiskernel - Installation - Installing to /lib/modules/4.15.0-106-generic/updates/dkms/
root@hqdc034:~# wg-quick up wg0 [#] ip link add wg0 type wireguard [#] wg setconf wg0 /dev/fd/63 [#] ip -4 address add 192.168.10.2/24 dev wg0 [#] ip link set mtu 1420 up dev wg0 [#] resolvconf -a tun.wg0 -m 0 -x [#] ip -4 route add 140.112.0.0/16 dev wg0 [#] ip -4 route add 104.31.0.0/16 dev wg0
root@hqdc034:~# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 00:10:18:14:0f:0a brd ff:ff:ff:ff:ff:ff inet 192.168.11.34/24 brd 192.168.0.255 scope global enp3s0 valid_lft forever preferred_lft forever inet6 fe80::2537:5b36:df2:7c0e/64 scope link valid_lft forever preferred_lft forever 3: enp0s31f6: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000 link/ether 70:4d:7b:a3:66:f1 brd ff:ff:ff:ff:ff:ff
30: wg0: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1420 qdisc noqueue state UNKNOWN group default qlen 1000 link/none inet 192.168.10.2/24 scope global wg0 valid_lft forever preferred_lft forever root@hqdc034:~# ip r default via 192.168.11.253 dev enp3s0 src 192.168.11.34 metric 202 10.25.0.0/16 dev LoyaltyNet proto kernel scope link src 10.25.25.1 linkdown 104.31.0.0/16 dev wg0 scope link 140.112.0.0/16 dev wg0 scope link 192.168.10.0/24 dev wg0 proto kernel scope link src 192.168.10.2 192.168.11.0/24 dev enp3s0 proto kernel scope link src 192.168.11.34 metric 202 root@hqdc034:~#