Within a minute of connecting to my remote Linux server through SSH, my session times out and I cannot contact the server until a few seconds have passed. Meanwhile, I'm connected to other servers without interruption. This is only happening when I establish connection from an hotel wireless AP. When I connect from my phone's Internet, the problem does not occur. Does anyone know what might be causing these unusual timeouts?
Asked
Active
Viewed 3,229 times
3
-
What error message do you get? Are you actively using the connection when it times-out? – May 15 '10 at 23:30
-
This answer has some useful info: http://serverfault.com/questions/2201/ssh-session-idle-timeout – gareth_bowles May 16 '10 at 02:00
-
Sounds like the hotel's network has a really poor NAT implementation. – Zoredache May 16 '10 at 07:07
2 Answers
4
On your server, add the following line to /etc/ssh/sshd_config
and restart the SSH daemon:
ClientAliveInterval 30
This will cause the server to send a message to the client requesting a response, if there has been no activity for 30 seconds. (Basically a ping to see if the client is still there).
If the hotel's firewall is kicking off "inactive" connections, this should keep your connection open as it will see activity at least once every 30 seconds.

Nate
- 2,366
- 4
- 22
- 25
0
If it only happens when you are at a hotel, then the problem is the hotel.
It sounds to me like the hotel's NAT is configured to aggressively time-out idle-looking sessions.

David Mackintosh
- 14,293
- 7
- 49
- 78