Closed gurabli closed 4 years ago
Unfortunately, WireGuard only looks up the IP once in the beginning, so it will break whenever your DDNS IP rotates. It sounds like your problem is something else though, do you have KeepAlive
set on the client side, the server side, or both? and is the client behind a NAT?
I think you can automate a reconnect after 12hr using PostUP = bash -c 'sleep 43200; wg-quick down /path/to/wg0.conf && wg-quick up /path/to/wg0.conf'
.
Thanks! My problem is that tunnel brakes for an unknown reason for me, not because of IP change. It is dynamic, but changes once in a two weeks, or even less.
I think I have keepalive set only on client side. Should I set both?
And yes, both client and server are behind NAT (local address behind router).
If client and server are both behind a NAT, then you need KeepAlive
set on both, because outbound packets are needed on both sides to keep the forwarding entry alive in the NAT table.
If that doesn't work, let me know and I might have some other ideas.
After adding keep alive to both client and server, the tunnel is not braking anymore, perfect. Thanks for your help!
After adding keep alive to both client and server, the tunnel is not braking anymore, perfect. Thanks for your help!
how you add it to the server? after adding it like this:
[Interface] PrivateKey = 4O3loXmP7HtWwj/5rAWNRG9TzdNU87DbMT/G3BuOnX4= Address = 10.6.0.1/24 ListenPort = 51820 PersistentKeepalive = 25
I got an error:
[#] wg setconf wg0 /dev/fd/63 Line unrecognized: `PersistentKeepalive=25' Configuration parsing error
Use wg-quick
for the extended syntax instead of wg
.
PersistentKeepalive = 25
You have to put it in peer not in interface
Hi, I have configures WG between two remote points. Everything works perfectly, except that I need to restart wg0 interface once almost each day as somehow the link goes down. Server is on ddns, but the ip is not changing frequently. I have set keepalive in config. Still, I need to do down and up on client to bring back connection once in a day or two. The server ip doesn't change.
Any script or idea how to automate this so that it checks if tunnel is up and running, and if not, to resume connection? Or to really keep alive the connection?
Server running Ubuntu Serve 18.04, client Ubuntu Server 16.04.
Many thanks