我无法让我的 WIreguard 隧道完成握手

我无法让我的 WIreguard 隧道完成握手

我正在尝试在两个独立网络上的两个不同点之间设置点到站点的 wireguard 隧道,但是已经在类似情况下设置了类似的隧道,所以我不相信它与我的隧道端点之间的基础设施有任何关系。

一方面,我有一个虚拟机 Windows 客户端,其配置如下

[Interface]
PrivateKey = iOoRnq+ngYGZFGpSqnRGgBsUvh9AVtWAXZGEw2Ir1FI=
Address = 10.1.3.11/32
DNS = 8.8.8.8

[Peer]
PublicKey = +IrgeRu8nRBMWZrR8Grrxfe6mhSBUihyKKeKsoPJCGM=
AllowedIPs = 0.0.0.0/0
Endpoint = 172.16.2.53:51820
PersistentKeepalive = 15

另一边是一台虚拟机 Ubuntu 服务器(充当路由器),配置如下

[Interface]
PrivateKey = +PYij5eViZfalUxsxR8XHf4xX8Jwiap7SyGn/Ok992k=[Interface]
PrivateKey = +PYij5eViZfalUxsxR8XHf4xX8Jwiap7SyGn/Ok992k=
Address = 10.1.3.10/32
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT
PostUp = iptables -t nat -A POSTROUTING -o ens33 -j MASQUERADE
PostUp = iptables -t nat -A POSTROUTING -o ens37 -j MASQUERADE
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT
PostDown = iptables -t nat -D POSTROUTING -o ens33 -j MASQUERADE
PostDown = iptables -t nat -D POSTROUTING -o ens37 -j MASQUERADE
ListenPort = 51820

[Peer]
PublicKey = T54bRdcw6J5QqOm1VsIjX0bH9GJvhreZQTwzBFCEgnc=
AllowedIPs = 10.1.3.11/32
~

我知道两端正在互相交谈,因为我可以看到 Windows 端的传输统计数据,显示正在接收和发送的数据。

在 Windows 客户端的日志中,我有以下内容:


2022-05-17 20:10:33.330829: [TUN] [LAN-Router] Peer 1 created
2022-05-17 20:10:33.334575: [TUN] [LAN-Router] Monitoring MTU of default v6 routes
2022-05-17 20:10:33.332262: [TUN] [LAN-Router] Sending keepalive packet to peer 1 (172.16.2.53:51820)
2022-05-17 20:10:33.332958: [TUN] [LAN-Router] Sending handshake initiation to peer 1 (172.16.2.53:51820)
2022-05-17 20:10:33.334575: [TUN] [LAN-Router] Interface up
2022-05-17 20:10:33.345348: [TUN] [LAN-Router] Setting device v6 addresses
2022-05-17 20:10:33.350652: [TUN] [LAN-Router] Receiving handshake response from peer 1 (172.16.2.53:51820)
2022-05-17 20:10:33.350652: [TUN] [LAN-Router] Keypair 1 created for peer 1
2022-05-17 20:10:33.361014: [TUN] [LAN-Router] Monitoring MTU of default v4 routes
2022-05-17 20:10:33.361014: [TUN] [LAN-Router] Setting device v4 addresses
2022-05-17 20:10:33.403831: [TUN] [LAN-Router] Startup complete
2022-05-17 20:10:48.459601: [TUN] [LAN-Router] Retrying handshake with peer 1 (172.16.2.53:51820) because we stopped hearing back after 15 seconds
2022-05-17 20:10:48.459601: [TUN] [LAN-Router] Sending handshake initiation to peer 1 (172.16.2.53:51820)
2022-05-17 20:10:50.275215: [TUN] [LAN-Router] Receiving keepalive packet from peer 1 (172.16.2.53:51820)
2022-05-17 20:10:53.585242: [TUN] [LAN-Router] Handshake for peer 1 (172.16.2.53:51820) did not complete after 5 seconds, retrying (try 2)
2022-05-17 20:10:53.585242: [TUN] [LAN-Router] Sending handshake initiation to peer 1 (172.16.2.53:51820)
2022-05-17 20:10:56.294435: [TUN] [LAN-Router] Receiving handshake response from peer 1 (172.16.2.53:51820)
2022-05-17 20:10:56.294435: [TUN] [LAN-Router] Keypair 2 created for peer 1
2022-05-17 20:10:56.294435: [TUN] [LAN-Router] Sending keepalive packet to peer 1 (172.16.2.53:51820)
2022-05-17 20:11:12.348180: [TUN] [LAN-Router] Retrying handshake with peer 1 (172.16.2.53:51820) because we stopped hearing back after 15 seconds
2022-05-17 20:11:12.348180: [TUN] [LAN-Router] Sending handshake initiation to peer 1 (172.16.2.53:51820)
2022-05-17 20:11:13.373244: [TUN] [LAN-Router] Receiving handshake initiation from peer 1 (172.16.2.53:51820)
2022-05-17 20:11:13.373244: [TUN] [LAN-Router] Sending handshake response to peer 1 (172.16.2.53:51820)
2022-05-17 20:11:13.382240: [TUN] [LAN-Router] Keypair 1 destroyed for peer 1
2022-05-17 20:11:13.382240: [TUN] [LAN-Router] Keypair 3 created for peer 1
2022-05-17 20:11:13.384241: [TUN] [LAN-Router] Invalid handshake response from 172.16.2.53:51820
2022-05-17 20:11:17.360089: [TUN] [LAN-Router] Handshake for peer 1 (172.16.2.53:51820) did not complete after 5 seconds, retrying (try 2)
2022-05-17 20:11:18.524497: [TUN] [LAN-Router] Receiving handshake initiation from peer 1 (172.16.2.53:51820)
2022-05-17 20:11:18.524497: [TUN] [LAN-Router] Sending handshake response to peer 1 (172.16.2.53:51820)
2022-05-17 20:11:18.528377: [TUN] [LAN-Router] Keypair 3 destroyed for peer 1
2022-05-17 20:11:18.528377: [TUN] [LAN-Router] Keypair 4 created for peer 1
2022-05-17 20:11:18.530502: [TUN] [LAN-Router] Receiving keepalive packet from peer 1 (172.16.2.53:51820)
2022-05-17 20:11:41.490680: [TUN] [LAN-Router] Retrying handshake with peer 1 (172.16.2.53:51820) because we stopped hearing back after 15 seconds
2022-05-17 20:11:41.491688: [TUN] [LAN-Router] Sending handshake initiation to peer 1 (172.16.2.53:51820)
2022-05-17 20:11:43.383896: [TUN] [LAN-Router] Receiving handshake initiation from peer 1 (172.16.2.53:51820)
2022-05-17 20:11:43.383896: [TUN] [LAN-Router] Sending handshake response to peer 1 (172.16.2.53:51820)
2022-05-17 20:11:43.387327: [TUN] [LAN-Router] Keypair 2 destroyed for peer 1
2022-05-17 20:11:43.387327: [TUN] [LAN-Router] Keypair 5 created for peer 1
2022-05-17 20:11:57.082780: [TUN] [LAN-Router] Shutting down
2022-05-17 20:11:57.097321: [MGR] [LAN-Router] Tunnel service tracker finished

双方似乎在互相交谈,但在某些方面意见不一,或者可能是同一类型的数据包丢失了。我关闭了 ubuntu 服务器路由器上的防火墙,以确保这不是我的问题。我尝试在日志中搜索这些不规则的行,但我发现最好的解决方案是重试制作密钥,我已经做过几次了。我做错了什么?

相关内容