why do my ssh sessions freeze after some time?

Your NAT is dropping your TCP socket after a period of inactivity.

Your ssh client can optionally send periodic noops to the server, thereby eliminating this problem. To do this, add this to your ~/.ssh/config:

Host *
  ServerAliveInterval 60

Alternatively, re-configure your NAT to not expire items out of its state table as quickly as it is now.


In addition to the above, you should be using a terminal multiplexer for your sessions - something like GNU Screen or tmux. With either of those, you can recover your session in the event of getting disconnected.

Tags:

Ssh