If a firewall is configured to timeout SSH sessions and keep getting disconnected from SSH terminal windows here’s a handy setting to add to your ssh_config file.
Here’s an explanation of what it does.
ServerAliveInterval: number of seconds that the client will wait before sending a null packet to the server (to keep the connection alive).
ClientAliveInternal: number of seconds that the server will wait before sending a null packet to the client (to keep the connection alive).
Setting a value of 0 (the default) will disable these features so your connection could drop if it is idle for too long.
ServerAliveInterval seems to be the most common strategy to keep a connection alive.