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?
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.