Always on for Centos client machines

This forum is for admins who are looking to build or expand their OpenVPN setup.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Forum rules
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
Post Reply
useradmn
OpenVpn Newbie
Posts: 4
Joined: Mon Jul 15, 2013 7:34 pm

Always on for Centos client machines

Post by useradmn » Mon Jul 15, 2013 7:39 pm

Hello everyone,


I've setup OpenVPN on my linux server and i'm able to connect to it perfectly. However, my remote machines- sometimes lose connection while out in the field. Does anyone know a way that I can set the connection to restart once it is dropped? I'm trying to achieve an always-on scenario.


I guess I could write a script to check if pinging is successful, then attempt to kill the process and restart it. But not sure if this the best or most efficient way of doing it.


I'm not the advanced expert, so show me some mercy. :D


Thanks,

Daniel

mwandelaar
OpenVPN Super User
Posts: 219
Joined: Mon Nov 23, 2009 8:24 pm

Re: Always on for Centos client machines

Post by mwandelaar » Mon Jul 15, 2013 9:01 pm

When openvpn is started via the startup-scripts, is automatically trying to reconnect when a connection is failed. Even when it's started manually it should try to reconnect.

This implies starting openvpn as a service.
I've found 2 good manuals to do so:
Manual 1 and Manual 2

Please give it a try. And when it failed, can you post the openvpn-log on the failed connection, where openvpn bails-out?

--edit--
As i forgot, do you have

Code: Select all

keepalive 10 60
(or other values) in your server-config?

brendan
OpenVPN Power User
Posts: 110
Joined: Wed Oct 19, 2011 1:19 am

Re: Always on for Centos client machines

Post by brendan » Mon Jul 15, 2013 9:04 pm

look at the keepalive and assorted ping/ping-restart directives.

useradmn
OpenVpn Newbie
Posts: 4
Joined: Mon Jul 15, 2013 7:34 pm

Re: Always on for Centos client machines

Post by useradmn » Tue Jul 30, 2013 3:08 am

Thanks guys! That did it for me.


I appreciate the help.

Post Reply