0

I wireguard server and a single client have been setup on two VPSs to have a split tunnel in between, but every few hours, the client side connection stops and I have to restart the interface to reconnect again.

Both servers have public IP, there is no NAT or Firewalls.

server config

[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 ###

and the client

[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

even a cron job did not help (client side)

* * * * * /usr/bin/ping  -c4  172.31.104.1
6
  • See if this article helps: ............ learn.beako.net/books/wireguard/page/persistentkeepalive
    – anon
    Commented Feb 5 at 20:26
  • 1
    note: If both have public IP addresses, then PersistentKeepalive has no useful role and shouldn't even be needed anywhere. There's probably an other problem.
    – A.B
    Commented Feb 5 at 22:40
  • @A.B tried adding and removing PersistentKeepalive the thing is if I remove it , it stops working after few minutes, but when added lasts for hours, what else can cause this ? Commented Feb 6 at 4:57
  • NAT or firewall despite what you wrote. Perhaps not directly on your systems. Or Docker running on one of the systems. etc.
    – A.B
    Commented Feb 6 at 7:01
  • 1
    For each system can you provide their network configuration while VPN works? Something like ip link; ip -br addr; ip route; ip rule + nft list ruleset (as root) + the output of wg (as root). You can replace public IP addresses with 1 or 2 blocks from RFC 5737: rfc-editor.org/rfc/rfc5737.html#section-3 . Then when it fails some minutes or hours later again the very same commands.
    – A.B
    Commented Feb 6 at 7:03

0

You must log in to answer this question.

Browse other questions tagged .