You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

WireGuard PersistentKeepalive失效问题求助

WireGuard PersistentKeepalive失效问题求助

大家好,我碰到个WireGuard的头疼问题,想请各位帮忙看看:

我在两台带公网IP的VPS上分别搭建了WireGuard服务器和单客户端,用来做分流隧道。但现在每隔几个小时,客户端的连接就会断掉,必须手动重启WireGuard接口才能重新连上。两台机器都没有NAT和防火墙配置,按道理应该不会有端口被拦截的情况。

下面是我的配置文件:

服务器端配置

[Interface]
PrivateKey = ***
Address = 172.31.104.1/24
MTU = 1420
ListenPort = PORT

### begin c1 ###
[Peer]
PublicKey = ***
AllowedIPs = 172.31.104.2/32
PersistentKeepalive = 25
### end c1 ###

客户端配置

[Interface]
Address = 172.31.104.2/32
PrivateKey = ***
DNS = 1.1.1.2,1.0.0.2

[Peer]
PublicKey = ***
AllowedIPs = 172.31.104.1/24
Endpoint = IP:PORT
PersistentKeepalive = 25

我还尝试在客户端设置了定时任务,每分钟ping一次服务器的WireGuard内网IP,但是也没解决问题:

* * * * * /usr/bin/ping  -c4  172.31.104.1

有没有大佬遇到过类似的情况?或者能帮我排查下可能的原因?

备注:内容来源于stack exchange,提问作者Shakiba Moshiri

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.20 06:38:10