teddysun / across

Across the Great Wall we can reach every corner in the world
https://teddysun.com
Apache License 2.0
4.94k stars 2.22k forks source link

wireguard 在 openvz/lxc 上用 wireguard-go 替代 Kernel 可以吗? #100

Open fscarmen opened 2 years ago

fscarmen commented 2 years ago

我把检查虚拟化和安装 linux-header 注释掉,加了个 wireguard-go 进去,运行能起来走完。服务也好像开启了,但就是不通,还有什么方式需要处理呢?

root@woiden:~# wg-quick up wg0
[#] ip link add wg0 type wireguard
RTNETLINK answers: Operation not supported
[!] Missing WireGuard kernel module. Falling back to slow userspace implementation.
[#] wireguard-go wg0
┌───────────────────────────────────────────────────┐
│                                                   │
│   Running this software on Linux is unnecessary,  │
│   because the Linux kernel has built-in first     │
│   class support for WireGuard, which will be      │
│   faster, slicker, and better integrated. For     │
│   information on installing the kernel module,    │
│   please visit: <https://wireguard.com/install>.  │
│                                                   │
└───────────────────────────────────────────────────┘
INFO: (wg0) 2022/05/01 09:42:06 Starting wireguard-go version 0.0.20201118
[#] wg setconf wg0 /dev/fd/63
[#] ip -4 address add 10.88.88.1/24 dev wg0
[#] ip -6 address add fd88:88:88::1/64 dev wg0
[#] ip link set mtu 1420 up dev wg0

root@woiden:~# ss -nlup
State           Recv-Q          Send-Q                   Local Address:Port                      Peer Address:Port          Process                                            
UNCONN          0               0                              0.0.0.0:13613                          0.0.0.0:*              users:(("wireguard-go",pid=35107,fd=13))          
UNCONN          0               0                                 [::]:13613                             [::]:*              users:(("wireguard-go",pid=35107,fd=12)) 

root@woiden:~# 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: venet0: <BROADCAST,POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default 
    link/void 
    inet 127.0.0.1/32 scope host venet0
       valid_lft forever preferred_lft forever
    inet 192.168.0.148/22 brd 192.168.3.255 scope global venet0:0
       valid_lft forever preferred_lft forever
    inet6 2001:41d0:203:698:1234:1234:553d:1/112 scope global 
       valid_lft forever preferred_lft forever
8: wg0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1420 qdisc pfifo_fast state UNKNOWN group default qlen 500
    link/none 
    inet 10.88.88.1/24 scope global wg0
       valid_lft forever preferred_lft forever
    inet6 fd88:88:88::1/64 scope global 
       valid_lft forever preferred_lft forever
    inet6 fe80::c67e:83a:cdb3:f2ff/64 scope link stable-privacy 
       valid_lft forever preferred_lft forever