Restart WG Peer on host if handshake great than

Hi,

I have one scenario where wireguard wont connect until i disable\enable peer on host.
On all my other setups if i setup script to disable\enable peer on client then works great, i set that up here too but about once a week or so that vpn looses connection then i login to host mikrotik disable\enable peer then go to client mikrotik and disable\enable peer then it works great.

So my fix for this was to setup a script that would watch for long handshake on host and if found then disable\enable peer then i would use my existing script on client and it would disable\enable peer and then it should work.

My scripting skills are non existent but here is my start:

:if (/interface/wireguard/peers print detail where last-handshake > [:totime "10m"] ) do={
      
}

This is code i used in my other script but not sure how to use it to find peer with handshake longer than x:

/interface/wireguard/peers/disable [find endpoint-address=$endpointip];

What version of ROS are you using ?

Make it easier, just see if you can reach ‘the other side’ using netwatch.
See this excellent guide compiled by anav, especially the part with the scripts to toggle peer status.
https://forum.mikrotik.com/viewtopic.php?t=182340

I am using v7.7

ok i will try and read through that.

Get at least 7.10, or better 7.11.2.
There have been fixes related to wireguard in there.