Community discussions

MikroTik App
 
User avatar
npeca75
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 75
Joined: Thu Aug 03, 2017 3:12 pm

how to check wireguard is running?

Mon Aug 23, 2021 9:15 pm

Hi to all

currently i have dozen of L2TP dialin interface, which i like to change for wireguard
ok
setting up wireguard is easy, but one thing what is important for me is missing

on L2TP i could "hook" script on UP/DOWN event, so i could generate traps, send emails, whatever i like on interface UP/DOWN
it is important feature because i need to know when the remote site is UP or DOWN
and yes, it could not have false positive, because events are triggered on UP/DOWN so they are always valid

how to achieve same/similar behavior with wireguard interfaces ?
 
nescafe2002
Forum Veteran
Forum Veteran
Posts: 897
Joined: Tue Aug 11, 2015 12:46 pm
Location: Netherlands

Re: how to check wireguard is running?

Tue Aug 24, 2021 10:21 am

Since WireGuard uses fixed ip addresses anyway, could you just set up a netwatch entry for the remote host and implement the functionality in up/down scripts?
 
User avatar
npeca75
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 75
Joined: Thu Aug 03, 2017 3:12 pm

Re: how to check wireguard is running?

Tue Aug 24, 2021 12:48 pm

Since WireGuard uses fixed ip addresses anyway, could you just set up a netwatch entry for the remote host and implement the functionality in up/down scripts?
hi @nescafe2002

yes, there is always a "scripting way" to make a things work
but i like to avoid this approach because, IF UP/DOWN events are generated by OS, so basically, you could never miss a short outages
and yes, i could PING, then simulate TRAP and send events, but ... there is always a chance to miss short/rapid disconnections, flapping

that is a reason why i asked in this forum, maybe i am overlooked some checkbox in Winbox, or some CLI ... but i am afraid that the WG protocol work this way, it is stateless

anyway , thank you for answer
 
nescafe2002
Forum Veteran
Forum Veteran
Posts: 897
Joined: Tue Aug 11, 2015 12:46 pm
Location: Netherlands

Re: how to check wireguard is running?  [SOLVED]

Tue Aug 24, 2021 1:22 pm

Ok, afaik WireGuard is stateless, so no connect / disconnect occurs.

There is a last handshake property which you can use to detect activity, but since that would be based on a timeout - netwatch would be a better option.

Who is online

Users browsing this forum: No registered users and 19 guests