Wireguard client connection renewal on OpenWrt

I use Wireguard on my router as a Client in my house in the mountains. I have the problem, when I restart the ruouter where I have installed wireguard server I lose the connection with the client.

Is there a way to renew the client wireguard connection automatically (example: every 8 hours) on Openwrt?

This allows me to solve the problem by waiting for a maximum of 8 hours.

There is the persistent-keepalive option to keep the connection active. Doesn't that work for you?

Hi.
Close situation that have with mikrotik client.
Solution for most of mikrotik users, crontab running on client side, with a simple script running every 5/10 mns, with a ping to internal ip of your router server. If ping fail, restart wireguard from client side.
Not a clean solution, but does the job.

Wireguard watchdog - cron job
Persistent keep alive on

Something else is wrong then, e.g. firewall.

I router I have a GL.iNet GL-AR750. When the server changes IP (router restart), the client connection remains on the old IP and the vpn tunnel does not work. To reactivate it I have to renew the "wireguard" interface in OpenWRT, and it takes the new IP. Persistent Keepalive should check the connection life every 25s but it doesn't seem to work.

Put

* * * * * /usr/bin/wireguard_watchdog

into "System" -> "Scheduled tasks" per lleachi instructions.
It will sort dynamic IP change at "server" peer side. Total downtime with this should be 150 seconds in worst case regarding wireguard (add router restart time and maybe a few name server resolution failures and thats it).

i just have to paste the string into schedule tasks?

I believe that script is part of wireguard-tools, so one needs to install that package first and paste mentioned code into text field and click submit button.

1 Like

Hi.
Correct, this script is part of wireguard basic installation.

root@C5_1200:~# ls /usr/bin/w
wc                  wget                wireguard_watchdog
1 Like

OK. It works perfectly
Thanks