Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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

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).

share|improve this answer

Insert on the client:

keepalive 10 60 

This will keep your connection up.

share|improve this answer
Please provide more details for your answer. Where does that get inserted? What does it do? – Taegost Aug 14 '13 at 15:11
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .