On some occassions, you may be using , OpenVPN to VPN to a server to perform some maintenance work. In some cases (such as the nature of my job), we have to connect to an acknowledged server via VPN to connect to a server if there are IP restrictions.
By doing so, you may experience timeout errors upon connecting to a server. This may occur if you left the connection idle for some time (typically, 10 minutes), and you would have to wait for some time for the VPN connection to be re-establish.
There’s a configuration fix that you can perform to avoid such timeouts from occuring, in which a simple line can prevent frustrations.
Open up your
.ovpn file via terminal:
Input this line between
# Set log file verbosity.:
keepalive 10 600
This would ping the instance every 10 seconds if there was a timeout period within 600 seconds.
Save the file, and test your OpenVPN connection again. Go make your coffee to simulate the timeout process, and notice that your connection will not be dropped.
Alternatively, if you are performing server maintenance, you can always use screen to perform long running tasks in case your connection becomes unstable.
You can read more of OpenVPN configurations from the OpenVPN Documentation.