Jump to content
Not connected, Your IP: 3.233.239.102
Sign in to follow this  
hawkflights

Automatically Restarting OpenVPN Connection after Disconnection (or Outage)?

Recommended Posts

My home Linux desktop connects to Air using a straight OpenVPN (2.4.8) config and openresolv.  Results are good: my ISP offers me a decent line so I can usually keep a VPN connection up for days.
But there are infrequent outages.  And, of course, sometimes the connection to the VPN server itself drops for reasons unrelated to my home connection (e.g., maintenance by data center).  When I'm home I can simply restart the connection as needed.
However as I spend more time away from home, manually restarting isn't an option.  If the VPN connection should fully drop for any reason and gets stuck in an infinite retry loop then public-facing services (e.g., ssh, ftp) become inaccessible.

Is there a way to have OpenVPN automatically reconnect following outages or disconnections?

Share this post


Link to post
@hawkflights

Hello!

OpenVPN tries to re-connect by default, as you have noticed. To make it rotate VPN servers when a connection fails, you can consider to add multiple remote lines in your profile. When a connection attempt fails, OpenVPN will pass to the next remote line, trying the next server in the "remote" list.

Should you wish to start with a random server, add also remote-random directive; OpenVPN will rotate servers in sequence as usual, but it will start from a random server at startup.

Kind regards
 

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Security Check
    Play CAPTCHA Audio
    Refresh Image
Sign in to follow this  

×
×
  • Create New...