Community discussions

MikroTik App
 
knowledgemonster
just joined
Topic Author
Posts: 24
Joined: Fri Dec 04, 2015 3:47 pm
Location: Ontario Canada
Contact:

Restart WG Peer on host if handshake great than

Tue Sep 05, 2023 4:12 pm

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];
 
holvoetn
Forum Guru
Forum Guru
Posts: 5500
Joined: Tue Apr 13, 2021 2:14 am
Location: Belgium

Re: Restart WG Peer on host if handshake great than

Tue Sep 05, 2023 5:06 pm

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.
viewtopic.php?t=182340
 
knowledgemonster
just joined
Topic Author
Posts: 24
Joined: Fri Dec 04, 2015 3:47 pm
Location: Ontario Canada
Contact:

Re: Restart WG Peer on host if handshake great than

Tue Sep 05, 2023 11:37 pm

I am using v7.7

ok i will try and read through that.
 
holvoetn
Forum Guru
Forum Guru
Posts: 5500
Joined: Tue Apr 13, 2021 2:14 am
Location: Belgium

Re: Restart WG Peer on host if handshake great than

Wed Sep 06, 2023 6:33 am

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

Who is online

Users browsing this forum: No registered users and 11 guests