Keep your ssh connections from dropping when your wifi burps

SSH & Remote Administration

Keep your ssh connections from dropping when your wifi burps

🧩 The Challenge

Everyone hates that moment when you pause for a coffee, come back, and your terminal is frozen because your local router decided to refresh its lease. I have spent way too many hours waiting for an unresponsive shell to finally time out so I could reconnect.

💡 The Fix

You can tell your SSH client to send little heartbeat signals to the server, keeping the connection alive even if you’re inactive or bouncing between networks. This stops the silent disconnects that usually plague long-running sessions.

echo "ServerAliveInterval 60" >> ~/.ssh/config

⚙️ Why It Works

Setting this interval forces the client to send a null packet to the server every minute, which prevents firewalls and routers from dropping the connection state due to inactivity. It’s a simple “hey, are you still there?” message that keeps the session from going stale.

🚀 Pro-Tip: Add ServerAliveCountMax 3 to the config to force a disconnect if three consecutive heartbeats fail, so you don’t keep hanging on a truly dead route.

Linux Tips & Tricks | © ngelinux.com | 10/13/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted