OPNsense Forum

English Forums => Virtual private networks => Topic started by: multimania on March 21, 2021, 10:39:12 AM

Title: Stop OpenVPN Client if WAN Gateway is down.
Post by: multimania on March 21, 2021, 10:39:12 AM
Hello,

i have problems with my opnsense as OpenVPN Client.
If i lost the WAN Connection, the OpenVPN Client is not going up.

If i stop the OpenVPN client and start again, it works.

What can i do to stop die OpenVPN Client on opnsense if my upstream WAN Gateway is marked as DOWN. And if the gateway is UP again start the OpenVPN Client again.

Thanks for your help.

Multi

Title: Re: Stop OpenVPN Client if WAN Gateway is down.
Post by: Greelan on March 21, 2021, 10:41:25 AM
I suggest using monit to monitor the PID for the gateway
Title: Re: Stop OpenVPN Client if WAN Gateway is down.
Post by: Greelan on March 21, 2021, 10:45:31 AM
This is in a different context and for a different purpose, but it may help with ideas: https://forum.opnsense.org/index.php?topic=18745.msg97953#msg97953
Title: Re: Stop OpenVPN Client if WAN Gateway is down.
Post by: multimania on March 21, 2021, 05:36:34 PM
thanks i have add a service to monit and can check the gw.

But i cant find a command to stop the openvpn client or start the client.
Title: Re: Stop OpenVPN Client if WAN Gateway is down.
Post by: multimania on March 21, 2021, 05:50:33 PM
i have try this:

https://forum.opnsense.org/index.php?topic=6979.msg30763#msg30763 (https://forum.opnsense.org/index.php?topic=6979.msg30763#msg30763)

But i thik it is too old, and dont work:
/usr/local/etc/rc.d/client1 onestatus
client1 is not running.


stop and start works didnt work to.


Title: Re: Stop OpenVPN Client if WAN Gateway is down.
Post by: Greelan on March 21, 2021, 08:25:51 PM
https://github.com/opnsense/core/issues/412