Possible WireGuard Handshake Retry Issue in RouterOS 7.18.2
Device Information
-
Device: MikroTik RB750Gr3 (hEX)
-
RouterOS Version: 7.18.2 (stable)
-
Architecture: mmips
Network Topology
Internet
↓
ISP Router (LAN 192.168.1.1)
↓
DMZ
↓
MikroTik hEX
↓
Internal LAN
The ISP router forwards traffic through DMZ to the MikroTik WAN interface.
WireGuard Configuration
The MikroTik is configured as a WireGuard server.
Three peers are configured:
-
Android phone
-
Home notebook
-
Second notebook
Configuration characteristics:
-
No endpoint-address configured on any peer.
-
No endpoint-port configured.
-
Only allowed-address and public-key configured.
-
Initially persistent-keepalive=25s was configured.
-
For testing purposes, persistent-keepalive was later removed completely from all peers.
-
The behaviour remains exactly the same after removing persistent-keepalive.
Reproducible Procedure
The following procedure reproduces the behaviour consistently:
-
Enable the WireGuard tunnel on the Android phone.
-
Use the VPN normally for approximately one minute.
-
Disable the VPN from the Android client.
-
Observe the RouterOS logs.
After disconnecting, RouterOS starts generating messages similar to:
Handshake for peer did not complete after 5 seconds, retrying (try 2)
followed later by:
Handshake for peer did not complete after 20 attempts, giving up
Tests Performed
The following tests were performed in order to eliminate configuration errors:
-
Verified that endpoint-address is empty.
-
Verified that endpoint-port is not configured.
-
Removed persistent-keepalive from MikroTik peers.
-
Rebooted the complete network infrastructure.
-
Verified CPU usage remains very low.
-
Verified memory usage remains normal.
-
Verified there are no active VPN clients.
-
Completely powered off the Android phone.
-
Verified notebooks are powered off.
Despite all of the above, repeated handshake retry messages continue to appear.
Very Important Observation
This appears to be fully reproducible.
If the affected WireGuard peer is:
-
manually disabled,
-
left disabled for approximately 10 seconds,
-
and then enabled again,
the repeated handshake retry messages stop immediately.
The RouterOS log becomes completely clean again.
After that, no further handshake retry messages are generated.
However, if the Android client is connected again, used normally, and then disconnected, the same behaviour appears again and can be reproduced repeatedly.
This specific observation may help identify whether some internal peer state is not being cleared correctly after client disconnection.
Resource Usage
CPU usage remains approximately 4%.
Memory usage remains normal.
There is no apparent performance issue, but the repeated handshake attempts appear unexpected.
Request
Could you please clarify whether this is expected WireGuard behaviour in RouterOS 7.18.2?
If it is expected, could you please explain why RouterOS continues attempting handshakes after:
-
the client has disconnected,
-
the client has been completely powered off,
-
no endpoint-address is configured,
-
and no active VPN client exists?
If this is not expected behaviour, could this indicate an issue in peer state handling or handshake retry logic?
I intentionally did not include a supout.rif because it contains sensitive infrastructure information.
However, the behaviour appears to be reproducible using the procedure described above, and I hope this information is sufficient to reproduce the issue in a laboratory environment.