SSH Timeouts when going through NAT
Very simple problem:
When connecting to an SSH server outside your localnet when you are behind NAT, no matter what you try the session always times out after about 5 minutes of inactivity.
Very simple solution:
/etc/ssh/ssh_config or ~/.ssh/config :
Alternatively you can specify it on the command line:
I don’t know why it took me so long to stumble upon this one. I had tried everything I could think of including TCP keepalives and ClientAliveInterval settings on the server and it just wouldn’t prevent the session timing out even though they really ought to. The solution that definitely works is to set ServerAliveInterval in the client config.

I’ve never seen this problem. Been using ssh through two nats (Home Laptop -> NAT on home router -> NAT on provider -> Internet -> NAT in the office -> Office ssh server), and no timeouts whatsoever.
@slava_dp
Aren’t you lucky…