I may have found a possible issue related to the random-source-port
setting in MikroTik L2TP clients.
Test scenario:
- About 200
l2tp-client
instances. - These clients are constantly being reconnected (disconnect/reconnect loop).
/ip/service
shows the L2TP service with its assigned ports.
Observation:
- When
random-source-port
is enabled, the L2TP service port usage keeps increasing over time. - It seems that old/invalid port bindings are not released after the client disconnects.
- Eventually, this leads to a large number of “stale” ports being listed as in use, even though those sessions are no longer active.
Possible impact:
- System resource usage may increase over time.
- In extreme cases, it could cause L2TP connection issues or prevent new connections due to port exhaustion.
Questions:
- Is this expected behavior for L2TP with
random-source-port
enabled? - Should the unused ports be automatically released after the client disconnects?
If possible, it would be great to have:
- L2TP server support for a custom listening port.
- Matching support in
l2tp-client
to specify the destination port when connecting to the server.
This way, the server’s custom port and the client’s connection port setting can work together, making deployments more flexible and avoiding potential conflicts with the default L2TP port.