OPNsense Forum

English Forums => General Discussion => Topic started by: MartinsZB on July 25, 2019, 01:39:42 pm

Title: Single openVPN client restart with cron
Post by: MartinsZB on July 25, 2019, 01:39:42 pm
Hi!

I did read a lot of information, but can not figure out the following. I have two openVPN clients running. I would like to restart one of them using cron.

I find that I can restart whole openVPN service, but can not figure out, how to restart single client? It can be nicely done manually from GUI, but is it possible to schedule the restart?

Thanks,
Martins
Title: Re: Single openVPN client restart with cron
Post by: birdpark on July 25, 2019, 04:47:48 pm
As far as I know OpenVPN runs on virtual interfaces. You could make an up/down script that restarts that interface.
Title: Re: Single openVPN client restart with cron
Post by: MartinsZB on July 26, 2019, 08:36:23 am
Thanks! I tried the following.
My openVPN client is ovpnc3. If I do the "ifconfig ovpnc3 down" - under the interfaces it shows it as inactive. Although the client connection to VPN server seems still active. "ifconfig ovpnc3 up" brings the interface back up, but still with the same VPN connection.

What I want is to reconnect the openVPN client as I have multiple VPN servers defined with "select random server" activated.
Title: Re: Single openVPN client restart with cron
Post by: birdpark on July 26, 2019, 06:05:03 pm
What about using something like screen. Are you familiar with the screen command? I dont have other ideas
If it works, give me some karma or applause
Title: Re: Single openVPN client restart with cron
Post by: johnw230873 on July 31, 2019, 08:57:16 pm
Don't know if it helps but I found when the OPENVPN interface went down they just start using the standard gateway. I got around this by creating a new vlan only for the VPN clients and not OUTBOUND natting this vlan (all the rest of the setup was normal). Could this be what you are seeing when you down the interface, them flicking to another gateway to get out?
 
Title: Re: Single openVPN client restart with cron
Post by: johnw230873 on August 01, 2019, 07:56:07 pm
opps - wrong topic ;)