Hello everyone,
I’m having trouble maintaining a stable connection to Winbox over an IPsec VPN tunnel between two Mikrotik routers. Here’s the setup and the issue I’m encountering:
Setup:
-Two Mikrotik routers are connected over an IPsec VPN tunnel.
-The VPN is working as expected: the tunnel establishes successfully, and I can ping devices on the opposite end.
-I’ve set up firewall rules to allow traffic on port 8291 (Winbox) and 443 (HTTPS) for remote access to the routers.[/list]
The Issue:
While I can connect to the remote router using Winbox, the connection frequently drops out. And the Winbox session will sometimes load the configuration, sometimes not.
Winbox begins to load the configuration, but the session quickly resets, and I see messages in the router logs indicating that the remote PC is repeatedly logging in and out.
Troubleshooting Steps Taken So Far:
Firewall Rules: Verified that the firewall rules are correctly allowing traffic on the required ports (8291 for Winbox and 443 for HTTPS).
IPsec Policy Settings: Confirmed that IPsec policies match on both routers, so there shouldn’t be a mismatch in encryption or hashing settings.
MTU/MSS Mismatch Suspected:
Since VPN tunnels add overhead, I suspect that MTU or MSS mismatches are causing packet fragmentation, which might be interrupting the connection.
I’ve learned that lowering the MTU and clamping the MSS can help prevent this.
Configured MSS Clamping:
To address the potential packet fragmentation, I added a firewall mangle rule to adjust the MSS (Maximum Segment Size) on packets passing through the VPN.
I set up the following mangle rule on both ends of the VPN:
Chain: forward
Protocol: tcp
TCP Flags: syn (to ensure MSS changes only affect TCP SYN packets)
Action: change MSS
New MSS: 1300 (a safe value for most IPsec VPN tunnels)
By setting tcp-flags=syn, I avoided the Mikrotik error that prevents MSS adjustments on packets that aren’t SYN packets.
Adjusted MTU: Lowered the MTU on the VPN interface to 1300 on both routers to reduce the likelihood of fragmentation within the tunnel.
Current Status:
After applying these changes, the connection is somewhat more stable, but I still experience Winbox dropouts. I’m wondering if I need to fine-tune the MSS value or if there could be other underlying causes, such as IPsec rekeying issues or additional firewall adjustments.
Has anyone experienced similar issues with Winbox over an IPsec VPN, or are there other recommended settings for optimizing Mikrotik VPN stability?
Thanks in advance for any insights!
Kind regards.