Coding For Me

Coding and Tech Findings


ubuntu

Keeping a OpenVPN Connection Alive in Ubuntu

| 1 Comment

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:

vi test.ovpn

Input this line between comp-lzo and # 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.

Final Words

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.

Have fun!

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Author: jusuchin85

27 year old Software Engineer for Comptel in Kuala Lumpur. Loves Linux and Android, and finds cooking home cooked-food is sometimes better than eating out. Anime and manga fulfills his hunger for entertainment, as are Marvel movies.