OpenVPN sessions remain active after client disconnect

Started by giox969, May 07, 2025, 11:03:45 PM

Previous topic - Next topic
Hello!

I'm new to OPNsense, having just migrated from pfSense. I'm currently using OPNsense 25.1.5_5-amd64.

I've configured an OpenVPN server in "VPN: OpenVPN: Instances" and downloaded the .ovpn file from "VPN: OpenVPN: Client Export." I've also configured the necessary firewall rules.
The connection works properly - I can successfully reach all internal PCs on the LAN. However, I'm experiencing an issue: when I disconnect the client, the connection is never removed from the Connection Status list on the OPNsense side. The IP address is not released, and the route to the client is not removed.

Since the client disconnects every two minutes due to "Inactivity timeout (--ping-restart)" when there's no traffic, the list of active sessions on the server side grows indefinitely.

What am I doing wrong? Why aren't connections being released on the server side?

Thank you.

Ok, half answer found: to avoid clients restarting every two minutes, in the openvpn server instance editor, enable advanced mode and set "Keep alive interval" to 10, and "Keep alive timeout" to 60.
Another useful option to mitigate IP wasting after reconnection, is to enable explicit-exit-notify in both Push Options and Options.