Automatically reconnect to VPN when it drops
- by IAmAI
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.