10

I'm using NetworkManager and OpenVPN on linux.

The problem is I get random disconnections, especially when idle.

So I was thinking maybe there was an option to keep it alive. I have seen examples for OpenVPN config files, but I don't think I'm using one. I have set up everything directly from the NetworkManager. I found the NetworkManger config file for my current connection, and it has these sections: [connection], [vpn], and [ipv4]. Does any of those have a keepalive option? What's the syntax, and how does it work?

2
  • You might want to show us the logs of your VPN connection, both server and client. OpenVPN indeed has a keepalive option, but NM GUI has no way to pass the parameters, so you might want to hack into the global OpenVPN configuration, but I didn't find one, so it may be hard coded into NM. – Braiam Jul 30 '13 at 3:35
  • If you're using a shell only, I'd suggest the use of screen or tmux so a disconnect doesn't hurt that much anymore. – ott-- Jun 9 '15 at 16:27
17

According to the documentation here, the KeepAlive parameter is probably what you were looking for.

# The keepalive directive causes ping-like
# messages to be sent back and forth over
# the link so that each side knows when
# the other side has gone down.
# Ping every 10 seconds, assume that remote
# peer is down if no ping received during
# a 120 second time period.
keepalive 10 120

This should either be added to the OpenVPN connection profile as a new line, or to the Advanced Configuration on the server (likely /etc/openvpn/openvpn.conf).

-2

You have to do it each time you start up but what is wrong with just setting up ping xx - t in a terminal window. Its low overhead and certainly fixes my problems in Windows 10 VPN which is locked down to a 30 minute idle timeout.

-3

Insert on the client:

keepalive 10 60 

This will keep your connection up.

4
  • 4
    Please provide more details for your answer. Where does that get inserted? What does it do? – Taegost Aug 14 '13 at 15:11
  • 1
    I didn't downvote you, but seriously, where do I insert that line? – ChocoDeveloper Aug 15 '13 at 17:04
  • insert into the config file on client side. On linux, located /etc/openvpn/client.conf – user476624 Aug 1 '15 at 17:31
  • 1
    keepalive is a server side directive, not a client one. – James White Apr 27 '20 at 21:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.