🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

7 total messages Started by Lawrence D’Oliveiro Wed, 25 Nov 2026 22:29
Keeping An OpenVPN Connection Alive
#192
Author: Lawrence D’Oliveiro
Date: Wed, 25 Nov 2026 22:29
36 lines
2740 bytes
I have two OpenVPN connections between my office and other premises:
one goes to a client’s location, and the other to my VPS at a hosting
service.

My email is delivered to the latter, and picked up on my main office
workstation by a cron task running every 10 minutes. Some days (like
recently), this task will report multiple connection failures per day.
Other times, it will work happily for days on end without a hiccup
reported.

The connection to the client’s office is not used in the same way --
only when I need to do some work for them.

Both leave my premises through my house internet router, so I don’t
think that can be the problem.

So I decided to compare the reliability of the two, with concurrent
ping tasks running continuously at the same (low) frequency.

I just had them running overnight at one ping a minute, and both
worked without a hiccup. So I stopped them and restarted this morning
with a ping frequency of once in 5 minutes, and already I was getting
lost packets to my VPS, while the client connection remained fine.

Now I have the frequency at one ping every 2½ minutes, and both are
back to working OK. This points to some kind of timeout happening on
the link to the VPS, with an expiry somewhere between 2½ and 5
minutes.

Looking the sort of errors logged, they say things like “TLS ERROR:
local/remote key IDs out of sync” and “TLS Error: TLS key negotiation
failed to occur within 60 seconds (check your network connectivity)”.

Keys getting out of sync is a peculiar one -- does that sound like
spurious packets coming in from some other source, that look like they
are coming from me?
Re: Keeping An OpenVPN Connection Alive
#193
Author: JJ
Date: Thu, 26 Nov 2026 02:58
41 lines
3273 bytes
On Wed, 25 Nov 2026 22:29:56 -0000 (UTC), Lawrence D’Oliveiro wrote:
> I have two OpenVPN connections between my office and other premises:
> one goes to a client’s location, and the other to my VPS at a hosting
> service.
> 
> My email is delivered to the latter, and picked up on my main office
> workstation by a cron task running every 10 minutes. Some days (like
> recently), this task will report multiple connection failures per day.
> Other times, it will work happily for days on end without a hiccup
> reported.
> 
> The connection to the client’s office is not used in the same way --
> only when I need to do some work for them.
> 
> Both leave my premises through my house internet router, so I don’t
> think that can be the problem.
> 
> So I decided to compare the reliability of the two, with concurrent
> ping tasks running continuously at the same (low) frequency.
> 
> I just had them running overnight at one ping a minute, and both
> worked without a hiccup. So I stopped them and restarted this morning
> with a ping frequency of once in 5 minutes, and already I was getting
> lost packets to my VPS, while the client connection remained fine.
> 
> Now I have the frequency at one ping every 2½ minutes, and both are
> back to working OK. This points to some kind of timeout happening on
> the link to the VPS, with an expiry somewhere between 2½ and 5
> minutes.
> 
> Looking the sort of errors logged, they say things like “TLS ERROR:
> local/remote key IDs out of sync” and “TLS Error: TLS key negotiation
> failed to occur within 60 seconds (check your network connectivity)”.
> 
> Keys getting out of sync is a peculiar one -- does that sound like
> spurious packets coming in from some other source, that look like they
> are coming from me?

Check using Trace Route instead of Ping, so that you'll know exactly which
network node within the network route (to specific network destination), is
performing poorly.
Re: Keeping An OpenVPN Connection Alive
#194
Author: Theo
Date: Thu, 26 Nov 2026 11:51
33 lines
2562 bytes
Lawrence D’Oliveiro <ldo@nz.invalid> wrote:
> I just had them running overnight at one ping a minute, and both
> worked without a hiccup. So I stopped them and restarted this morning
> with a ping frequency of once in 5 minutes, and already I was getting
> lost packets to my VPS, while the client connection remained fine.
> 
> Now I have the frequency at one ping every 2½ minutes, and both are
> back to working OK. This points to some kind of timeout happening on
> the link to the VPS, with an expiry somewhere between 2½ and 5
> minutes.

Are you on (CG)NAT by any chance?  It looks like the TCP connection is
timing out, which is common if you're going through a NAT box (it wants to
keep the size of its NAT tables under control).

Look at the 'keepalive' option in your OpenVPN config, which will send
idle messages in the socket to keep this from happening.

> Looking the sort of errors logged, they say things like “TLS ERROR:
> local/remote key IDs out of sync” and “TLS Error: TLS key negotiation
> failed to occur within 60 seconds (check your network connectivity)”.
> 
> Keys getting out of sync is a peculiar one -- does that sound like
> spurious packets coming in from some other source, that look like they
> are coming from me?

It sounds like rekeying isn't working, but I'm surprised that's happening on
connection idle - I'd expect it to be every 60/whatever minutes irrespective
of connection busyness.  Are you sure these are co-incident with the
dropouts?  Or maybe the above are just fallout from the network dropping
your socket but OpenVPN not noticing that directly?

Theo
Re: Keeping An OpenVPN Connection Alive
#196
Author: Lawrence D’Oliveiro
Date: Fri, 27 Nov 2026 20:43
16 lines
1610 bytes
On 26 Nov 2026 11:51:53 +0000 (GMT), Theo wrote:

> Are you on (CG)NAT by any chance?

Yes, I discovered I am.

> Look at the 'keepalive' option in your OpenVPN config, which will send
> idle messages in the socket to keep this from happening.

I added this line

    keepalive 60 120

to the server-side config, and even left a ping running once every
three minutes from my office overnight, and that seems to have made no
difference at all.
Re: Keeping An OpenVPN Connection Alive
#199
Author: Lawrence D’Oliveiro
Date: Mon, 30 Nov 2026 02:09
12 lines
1624 bytes
On Wed, 25 Nov 2026 22:29:56 -0000 (UTC), I wrote:

> I have two OpenVPN connections between my office and other premises:
> one goes to a client’s location, and the other to my VPS at a
> hosting service.

I’ve been trying to understand why the connection to my client’s place
seems to be rock solid, whereas I get these regular dropouts with the
one to the VPS.

One difference is that the client’s connection is configured to use
TCP (his choice, not mine), whereas I use UDP to get to the VPS.
Re: Keeping An OpenVPN Connection Alive
#201
Author: Nuno Silva
Date: Mon, 30 Nov 2026 10:32
22 lines
1927 bytes
On 2026-11-30, Lawrence D’Oliveiro wrote:

> On Wed, 25 Nov 2026 22:29:56 -0000 (UTC), I wrote:
>
>> I have two OpenVPN connections between my office and other premises:
>> one goes to a client’s location, and the other to my VPS at a
>> hosting service.
>
> I’ve been trying to understand why the connection to my client’s place
> seems to be rock solid, whereas I get these regular dropouts with the
> one to the VPS.
>
> One difference is that the client’s connection is configured to use
> TCP (his choice, not mine), whereas I use UDP to get to the VPS.

Then there is no connection, is there?

How does this play with NAT, is the expectation that "keepalive" avoids
changes also on connectionless traffic with the same origin/destination?

-- 
Nuno Silva
Re: Keeping An OpenVPN Connection Alive
#202
Author: Theo
Date: Mon, 30 Nov 2026 13:29
20 lines
1820 bytes
Nuno Silva <nunojsilva@invalid.invalid> wrote:
> On 2026-11-30, Lawrence D’Oliveiro wrote:
> >
> > One difference is that the client’s connection is configured to use
> > TCP (his choice, not mine), whereas I use UDP to get to the VPS.
> 
> Then there is no connection, is there?
> 
> How does this play with NAT, is the expectation that "keepalive" avoids
> changes also on connectionless traffic with the same origin/destination?

I'd not be surprised if the NAT box has different levels of timeout on TCP
and UDP sockets.  The use cases and table footprint for long running
connections on each are different, and maybe they set the timeouts different
as a result.

You could try adjusting down the 'timeout' value for UDP and see how low it
has to go before it prevents the drops.

Theo
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads