Restart IPsec VPN after a few minutes
-
Hello everyone,
My company just upgraded to a Netgate router with pfSense, and we're having some trouble keeping one tunnel up.
After a few minutes, it just stops working, although in Status it shows as "Established". If I manually disconnect it and connect it again, it works, and then it dies after a few minutes again.
I was experimenting with the command "ipsec restart" but it restarts every single connection. Is there a way to restart just the connection that I want? Or perhaps a better, automated solution?
Thanks.
-
The best thing to do would be to figure out why it's disconnecting and correct that. The logs would be helpful with that.
Failing that, you can use the
ipsec up
andipsec down
command on 2.4.x to up/down single tunnels, for reference look at how it's done when clicking the buttons on onstatus_ipsec.php
https://github.com/pfsense/pfsense/blob/RELENG_2_4_4/src/usr/local/www/status_ipsec.php#L54On 2.5.0 it's similar but there it uses
swanctl --initiate
andswanctl --terminate