Automatically reconnect to VPN when it drops

Posted by IAmAI on Super User See other posts from Super User or by IAmAI
Published on 2012-12-10T19:31:41Z Indexed on 2012/12/10 23:07 UTC
Read the original article Hit count: 164

Filed under:
|

I use OpenVPN to connect to a VPN service. I will often use it unattended and on occasion I have come back to find the service disconnected and GUI asking for login credentials. If the connection is disconnected by the service, and not me, I'd like it to attempt to reconnect automatically with no intervention from me, and ideally, if the reconnection attempt initially fails, keep attempting to do so at regular intervals until a connection is successfully.

Is there anyway to configure OpenVPN to do this? If not, can someone suggest a way of doing it with scripting (I use Windows)? Failing that, can anyone suggest a VPN solution that does this? The VPN provider supports PPTP as well as OpenVPN.

I have configured OpenVPN to read login credentials from a file. Below is my config script. I have censored any details specific to the VPN provider.

client
dev tun
proto tcp
remote ???.???.??? 0000
resolv-retry infinite
nobind
persist-key
persist-tun
ca ???.???.???
verb 3
mute-replay-warnings
float
reneg-sec 0
auth-user-pass auth.conf
auth-nocache

Thanks for your help.

© Super User or respective owner

Related posts about Windows

Related posts about openvpn