首页 > 解决方案 > Wireguard VPN 不接收来自服务器的数据

问题描述

我将wireguard服务器和客户端配置如下:

服务器:

[Interface]
PrivateKey = <server private key>
Address = 192.168.2.4
ListenPort = 51821

[Peer]
PublicKey = <client public key>
AllowedIPs = 172.20.10.5/32

客户:

[Interface]
PrivateKey = <client private key>
Address = 172.20.10.5

[Peer]
PublicKey = <server public key>
AllowedIPs = 192.168.2.4/32
Endpoint = <Public IP>:51821
PersistentKeepalive = 25

当我启动它们时,我的客户端无法 ping 服务器网络中的任何机器。在浏览器中,该 ip 仍然是客户端的互联网 IP。当我wg在客户端上运行时,它显示发送了一些数据,而在传输信息中收到了 0 个数据。

我的配置有什么明显的错误吗?如果没有,常见的故障排除方法是什么?

标签: wireguard

解决方案


也许尝试:

服务器:

[Interface]
PrivateKey = <server private key>
Address = 10.200.200.1/24
ListenPort = 51821

[Peer]
PublicKey = <client public key>
AllowedIPs = 10.200.200.2/32

客户:

[Interface]
PrivateKey = <client private key>
Address = 10.200.200.2/32

[Peer]
PublicKey = <server public key>
AllowedIPs = 10.200.200.1/24
Endpoint = <Public IP>:51821
PersistentKeepalive = 25

我没有尝试过 AllowedIPs 选项,所以我不能保证它会起作用。我可以通过删除这些行来保证它可以工作。但希望你已经弄清楚了自己!

如果有帮助,我已经做了一个教程:https ://github.com/agavrel/wireguard_cloud


推荐阅读