TCP Keepalive by Default
Some ISPs have this issue where TCP connections are closed after a couple of seconds of inactivity. I’ve experienced this on a VPS, apparently due to an incorrectly configured DDoS filter.
Applications like sshd can circumvent this by enabling a feature called “keepalive” on their TCP sockets to circumvent this by sending dummy TCP acknowledgements every couple of seconds while the connection is inactive.
However, there’s no immediately obvious way to make this the default system wide. In this post I’m documenting a way to do just that using an eBPF program for all incoming connections.