WireGuard 握手在 5 秒后未完成。无法连接到服务器

WireGuard 握手在 5 秒后未完成。无法连接到服务器

我在 Ubuntu 20.04LTS 上有 digitalocean vds。为了设置 WireGuard 我使用了这个指令https://www.vultr.com/docs/set-up-wireguard-vpn-on-ubuntu-20-04/。当我尝试连接 Android 手机或 iPad 时,我通常会在日志日志中看到:在此输入图像描述

线卫日志:

https://drive.google.com/file/d/17mJfn-3pL8blWptVu4oUC04vw3uCb1Sb/view?usp=sharing(我不知道这个文件到底需要什么。所以我把它留在这里。)

此时在服务器端:

#wg秀

interface: wg0
  public key: <pub key>
  private key: (hidden)
  listening port: 51820

peer: <pub key>
  endpoint: x.x.x.x:63360
  allowed ips: 172.26.5.67/32
  transfer: 2.46 KiB received, 1.53 KiB sent

#systemctl status wg-quick@wg0

[email protected] - WireGuard via wg-quick(8) for wg0
         Loaded: loaded (/lib/systemd/system/[email protected]; disabled; vendor pr>
         Active: active (exited) since Fri 2022-09-02 10:43:40 UTC; 2h 5min 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: 17323 ExecStart=/usr/bin/wg-quick up wg0 (code=exited, status=0/SU>
       Main PID: 17323 (code=exited, status=0/SUCCESS)

我已经与服务器建立了连接,但只连接了一次,断开连接后就再也没有重复过。

有服务器配置:

#sysctl-p

net.ipv4.ip_forward = 1

#ufw状态

状态:不活跃

[Interface]
   
Address = 172.26.3.155/16
   
SaveConfig = true
   
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A
POSTROUTING -o eth0 -j MASQUERADE
   
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D
POSTROUTING -o eth0 -j MASQUERADE
   
ListenPort = 51820
   
PrivateKey = server_private_key


[Peer]

Blockquote

PublicKey = client_pub_key

AllowedIPs = 172.26.5.67/32

Endpoint = xx.xxx.xx.xx:63364 <--my phone ip:port (port always changed after reconnection)

有客户端配置:

[Interface]

Address = 172.26.5.67/16

DNS = 1.1.1.1

PrivateKey = client_p_key

    

[Peer]

PublicKey = serv_pub_key

AllowedIPs = 0.0.0.0/0

Endpoint = xxx.xxx.x.x:51820 <- server ip:port ip wich I use to ssh connection
PersistentKeepalive = 25 

相关内容