• Keeping An OpenVPN Connection Alive

    From Lawrence =?iso-8859-13?q?D=FFOliveiro?=@ldo@nz.invalid to comp.misc on Wed Nov 25 22:29:56 2026
    From Newsgroup: comp.misc

    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?
    --- Synchronet 3.21e-Linux NewsLink 1.2
  • From JJ@jj4public@gmail.com to comp.misc on Thu Nov 26 09:58:53 2026
    From Newsgroup: comp.misc

    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.
    --- Synchronet 3.21e-Linux NewsLink 1.2
  • From Theo@theom+news@chiark.greenend.org.uk to comp.misc on Thu Nov 26 11:51:53 2026
    From Newsgroup: comp.misc

    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
    --- Synchronet 3.21e-Linux NewsLink 1.2
  • From Lawrence =?iso-8859-13?q?D=FFOliveiro?=@ldo@nz.invalid to comp.misc on Fri Nov 27 20:43:55 2026
    From Newsgroup: comp.misc

    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.
    --- Synchronet 3.21e-Linux NewsLink 1.2