Fremantle
My ISP Is Killing My Idle SSH Sessions. Yours Might Be Too. Posted on January 11, 2021 by Anders Trier:
So TCPKeepAlive enables keepalives handled by the TCP stack implementation (Linux in my case), whereas ServerAliveInterval enables protocol level keep-alives (handled by OpenSSH).
This explains the behavior we’re observing, but also raises new questions:
- Can I fix my problem by enabling the ssh protocol-level-keepalives? (ServerAliveInterval)
- Why are the TCP keepalives only sent after 2 hours?
- Why is my ISP dropping my TCP keepalive packages?
I verified that by setting ServerAliveInterval to 300 (5 min), my problems disappeared. We could stop now that I found a workaround, but let’s keep digging.
I documented my findings, and sent an email to my ISP. I quickly got a response back acknowledging that this is a bug on their side, and thanking me for my research. They still haven’t fixed the problem though.
I am experiencing similar things with my current (new) ISP, SpinTel. Haven't yet had any luck in solving it though. Borg keeps failing after ten minutes or so, and other ssh connections are (almost! but not quite) always failing after some amount of idle time. I've tried setting ServerAliveInterval 10
and ServerAliveCountMax 30
as suggested, but it's no good.
I guess I'll keep digging