Stop getting your SSH connections mangled by stateful firewalls
SSH & Remote Administration
Stop getting your SSH connections mangled by stateful firewalls
🧩 The Challenge
Ever notice your SSH sessions just hang forever when you stop typing for five minutes? It’s usually some overzealous stateful firewall dropping your connection entries because it hasn’t seen traffic in a while.
💡 The Fix
Tell your SSH client to periodically send a keep-alive packet to the server, which keeps the firewall’s table happy and your session from dying.
Host *
ServerAliveInterval 30
ServerAliveCountMax 3
⚙️ Why It Works
Setting the interval ensures the client sends a null packet every 30 seconds, preventing that silent connection drop. The count parameter tells it how many times to retry before finally giving up if the server actually disappears.
🚀 Pro-Tip: Put this in your ~/.ssh/config and never deal with a frozen terminal again.
Linux Tips & Tricks | © ngelinux.com | 11/14/2026
