What's new

Wireguard question

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

octopus

Part of the Furniture
Does anyone know what signal lights up the dot in the red circle.
Handshake turns it off after (3 minutes).

GT-AX6000 - VPN Client.png
 
Probably that it`s connected.
 
Does anyone know what signal lights up the dot in the red circle.
Handshake turns it off after (3 minutes).

View attachment 61874

What I mean is, is there any signal in the program that lights the point?
Anyone know where in the source code I can look?
Need this for my control script to monitor start/stop connect/disconnect in wiregaurd client.
 
What I mean is, is there any signal in the program that lights the point?
Anyone know where in the source code I can look?
Need this for my control script to monitor start/stop connect/disconnect in wiregaurd client.
I think it only monitor handshake timer. If > 3min (or missing) then it's offline. Use wg userspace tool to monitor this.

Example in @Martineau Wireguard Manager addon (search for Handshake)
https://github.com/MartineauUK/wireguard/blob/main/wg_manager.sh

I.e
Code:
wg show wgs1 latest-handshakes
Or
Code:
wg show wgs1 latest-handshakes | grep $(nvram get wgs1_c1_pub) | awk '{print $2}'
Or
Code:
echo $(($(date +%s)-$(wg show wgs1 latest-handshakes | grep $(nvram get wgs1_c1_pub) | awk '{print $2}')))
 
Last edited:
I think it only monitor handshake timer. If > 3min (or missing) then it's offline. Use wg userspace tool to monitor this.

Example in @Martineau Wireguard Manager addon (search for Handshake)
https://github.com/MartineauUK/wireguard/blob/main/wg_manager.sh

I.e
Code:
wg show wgs1 latest-handshakes
Or
Code:
wg show wgs1 latest-handshakes | grep $(nvram get wgs1_c1_pub) | awk '{print $2}'
Or
Code:
echo $(($(date +%s)-$(wg show wgs1 latest-handshakes | grep $(nvram get wgs1_c1_pub) | awk '{print $2}')))
Thank you, I have used this until now:
Code:
wg show wgs1 | grep handshake | cut -d ":" -f3 | cut -d ")" -f1
 
Thank you, I have used this until now:
Code:
wg show wgs1 | grep handshake | cut -d ":" -f3 | cut -d ")" -f1
sure, it all depends on how you whish to retrieve things in your script. Im not sure the order always stay the same? perhaps it is?

but to gain more control, I would probably use something like:
Code:
ClientNr=1
TimeSinceHandshake=$(($(date +%s)-$(wg show wgs1 latest-handshakes | grep $(nvram get wgs1_c"$ClientNr"_pub) | awk '{print $2}')))
which allows me to fetch each client handshakes individually. loop if needed.

however, you will probably need to check if the handshake is missing (client have never connected) otherwise you will get an error.

I think the handshake needs to happen between 120 - 180 seconds or a new key-exchange (or something) is needed. usually the timer gets reset quite early 120-130 seconds, but my VPS (Ubuntu) sometimes let it get up to 160. not sure if it's adaptive somehow if no data is transferred. I even saw sometimes when it let it up to 4-6 minutes but as soon as I connect through my VPS it handshakes and everything works without issues immediately..

but if its over 180sec clients may still be connected but dormant.
 

Similar threads

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top