3

Here is a situation which I noticed. I have a server to which I login via SSH and when I do it from lan then things work perfectly and I have noticed that even if the connection is idle (i.e. I am not doing any thing on SSH session just logged in) the connection is alive for a long time, but if I do an SSH on same server from internet then the connection after some time dies.The server is a Ubuntu 10.04 server edition server.What can be possible reason for this?

6

Enable keepalives in your ssh client, your firewall/router is killing the idle connection.

I have ServerAliveInterval 59 in ~/.ssh/config for openssh client.

2
  • Ok I do not have any such line as you mentioned since the server is in a corporate data centre is it possible for the sysadmin to detect an idle connection in this situation given the fact that to this server I am the only person who has SSH access to it. – Bond Jan 27 '11 at 7:10
  • Just as clarification; consumer grade hardware with little memory kills connections that haven't been active for a while. TCP keepalives can cause disconnects, so you can also, if you use something like screen or tmux, put a clock in your status bar so you have trafic all the time :) – Halfgaar Jan 27 '11 at 10:38
3

You could look at the TCPKeepAlive option in sshd_config on the server. It looks like if this is enabled you will see more disconnections (which seems a bit counter intuitive until you read the doc) as any route changes between you and the server will result in a disconnection. That is unlikely to happen on the LAN, but fairly likely across the internet.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.