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?


  • Rebel Alliance Developer Netgate

    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 and ipsec down command on 2.4.x to up/down single tunnels, for reference look at how it's done when clicking the buttons on on status_ipsec.php

    On 2.5.0 it's similar but there it uses swanctl --initiate and swanctl --terminate

Log in to reply