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

60 lines
1.5 KiB
Markdown
Raw Normal View History

---
title: Stalled SSH connections
summary: >
2024-11-17 12:18:44 +01:00
My pfSense removed valid connections obviosly.
This is how I solved it.
2024-11-17 12:18:44 +01:00
<small>The thumbnail was created with Google AI (Imagen 3).</small>
date: 2024-10-06T19:30:17+02:00
2024-12-17 18:24:02 +01:00
lastmod: 2024-12-17T17:24:02+0000
categories:
- computerstuff
tags:
- 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 <kbd>Firewall Optimization Settings</kbd> within
<kbd>System</kbd><kbd>Advanced</kbd><kbd>Firewall & NAT</kbd> to
<kbd>Conservative</kbd> I had no more of these hangs of my SSH sessions.
2024-10-06 21:10:37 +02:00
![pfSense settings](pfsense-netopt-settings.png)
I use the `ControlMaster` setting in my SSH configuration so the stalled
connections have to be killed with something like
```console
$ ssh -O exit {short hostname}
```
every time -- which is annoying.
2024-12-08 12:12:01 +01:00
{{< alert "triangle-exclamation" >}}
2024-12-17 18:24:02 +01:00
**Update on December 17 2024:**
2024-12-17 16:16:01 +01:00
A few changes to the SSH configuration on client and server have been made.
2024-12-08 12:12:01 +01:00
{{< /alert >}}
2024-12-17 16:16:01 +01:00
It got better, but I still experience the one or other hang.
I added/modified these entries within `Host *` in
<kbd>~/.ssh/config</kbd> on the client:
```apache
ServerAliveInterval 100
ServerAliveCountMax 10000
```
and made these changes/additions in <kbd>/etc/ssh/sshd_config</kbd>
on the server:
```apache
ClientAliveInterval 60
ClientAliveCountMax 10000
TCPKeepAlive yes
```