Why SSH sessions die quietly
An idle SSH connection can vanish without warning. NAT tables expire, firewalls drop idle TCP, your laptop goes to sleep — any of these can leave SSH thinking the session is alive while the path is dead. The next time you type a key, the session hangs forever or eventually times out with a confusing error.
ServerAliveInterval — proactive keepalive
Setting ServerAliveInterval 60 tells SSH to send an encrypted keepalive packet every 60 seconds. ServerAliveCountMax 3 says "if 3 in a row get no response, give up and disconnect cleanly." Together — keepalives every minute, and a clean disconnect after 3 minutes of silence instead of an indefinite hang.
The keepalive packets are tiny. The cost is negligible. Always set this in Host *. There's no scenario where you want SSH to silently freeze.
Server-side equivalent
The server has the mirror directives in /etc/ssh/sshd_config: ClientAliveInterval and ClientAliveCountMax. They do the same thing from the server's point of view — useful for kicking out clients that lost connectivity (otherwise their PTYs stick around forever).