hsand / pia-wg

A WireGuard configuration utility for Private Internet Access
GNU General Public License v3.0
303 stars 51 forks source link

Configs only valid for a couple of hours #22

Open MikealSouth opened 3 months ago

MikealSouth commented 3 months ago

Hi, this isn't related to this project but I couldn't think of any other group that would be able to help me out. So I've generated some configs, tested them, all is great. After a couple of hours I can't reconnect to the servers with the config. Is this something that is expected? If so I can't really use it on a router or with non PIA clients.

Avnsx commented 4 days ago

I believe this issue is not related to the Python script itself, but rather to the way WireGuard operates.

WireGuard's Persistent Keepalive feature is designed to maintain the connection, especially when the client is behind a NAT (Network Address Translation) or firewall. Based on the generated WireGuard .conf files, it looks like a keepalive request is set to trigger every 25 milliseconds. If this keepalive request isn't triggered for a while, the NAT binding might expire, causing the connection to drop.

This means you need to stay permanently connected, as intermittent connections won't remain valid or registered with the destination server after disconnecting for a few hours.

And about your statement with not being able to use it on routers, that's not true. You just need to have a router, which supports the keep-alive request. This is the case with German Fritz!Box routers for example, which in more recent operating system versions already have the Wire-Guard VPN functionality properly implemented, even together with the keep-alive request, the router will automatically keep handshaking with the destination server, in an effort to keep the connection alive forever.