我在两个 VPS 上设置了 wireguard 服务器和一个客户端,以便在它们之间建立一个分割隧道,但每隔几个小时,客户端连接就会停止,我必须重新启动界面才能再次重新连接。
两台服务器都有公共 IP,没有 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
甚至 cron 任务也无济于事(客户端)
* * * * * /usr/bin/ping -c4 172.31.104.1