oe7drt-website/content/posts/2024/70-stalled-ssh-connections/index.md

2.1 KiB

title summary date lastmod categories tags
Stalled SSH connections My pfSense removed valid connections obviosly. This is how I solved it. <small>The thumbnail was created with Google AI (Imagen 3).</small> 2024-10-06T19:30:17+02:00 2025-01-05T09:03:01+0000
computerstuff
networking
pfSense
openssh
selfhost

I spent some time adjusting my SSH configuration because I often get stalled connections to my servers but I never got that fixed until recently, when I started looking in my firewall settings on the pfSense.

After changing the Firewall Optimization Settings within SystemAdvancedFirewall & NAT to Conservative I had no more of these hangs of my SSH sessions.

pfSense settings

I use the ControlMaster setting in my SSH configuration so the stalled connections have to be killed with something like

$ ssh -O exit {short hostname}

every time -- which is annoying.

{{< alert "triangle-exclamation" >}} Update on December 17 2024:
A few changes to the SSH configuration on client and server have been made. {{< /alert >}}

It got better, but I still experience the one or other hang.

I added/modified these entries within Host * in ~/.ssh/config on the client:

ServerAliveInterval 100
ServerAliveCountMax 10000

and made these changes/additions in /etc/ssh/sshd_config on the server:

ClientAliveInterval 60
ClientAliveCountMax 10000
TCPKeepAlive yes

{{< alert "triangle-exclamation" >}} Update on January 5 2025:
Another change to the firewall setup in my home network. {{< /alert >}}

I did not had this on my mind but I accidentally saw my firewall retrieving a blacklist from my server and like instantly my ssh session was unusable again.

I now reduced the amount of updates the firewall retrieves the blacklist and hope for the best!

pfBlockerNG settings of blacklisted IPs