Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: SSH timeout
PostPosted: Tue Mar 15, 2011 6:52 am 
Offline
Newbie

Joined: Tue Mar 15, 2011 6:39 am
Posts: 2
So I host a two websites on my server and I also run tmux with weechat-curses inside. Normally (well up until about 8PM EDT), I would SSH into my linode, then issue 'tmux attach -d' and open up my tmux session and watch IRC while doing other things. However, now when I do this after roughly 3 minutes (even if I am active typing during the 3 minutes) I get disconnected from the Linode and issued this error:

"Timeout, server not responding."

When I SSH back in everything is as it was right before I got disconnect, tmux is still running and weechat is still connected to the IRC network.

So here is what I have tried: I change my ~/.ssh/config to have the TCPKeepAlive and ServerAliveInterval lines. This did nothing.

Host idle
TCPKeepAlive yes
ServerAliveInterval 20
Hostname 173.255.236.80
User yano

I even tried adding "ServerAliveInterval 60" to /etc/ssh/ssh_config and then did "sudo /etc/init.d/sshd restart" and reconnected.

I even stopped MySQL (which I don't even use and it was only running from an incomplete mail server setup), Apache, and NTP. I was thinking maybe there was some high traffic coming on my server.

I've also tried connecting from a different ISP.

I even reverted my SSH config file back to the original and restart SSHD, no luck.

I contacted support but they didn't mention anything about possible network problems on there end, so I'm left to assume this problem is either with my VPS SSH configuration on computer I'm connecting from, or the ISPs I'm testing from.

Any ideas?


Top
   
 Post subject: SSH disconnect solution
PostPosted: Tue Mar 15, 2011 3:05 pm 
Offline
Senior Newbie

Joined: Tue Sep 08, 2009 12:07 pm
Posts: 17
I believe the following would fix the SSH disconnect problem:

In the /etc/ssh/sshd_config on your linode (server)

KeepAlive yes
ClientAliveInterval 120
ClientAliveCountMax 5

This causes the linode to send keepalives to the client every 120 seconds and allow the client to fail to respond 5 times before disconnecting.


Top
   
 Post subject:
PostPosted: Tue Mar 15, 2011 3:33 pm 
Offline
Newbie

Joined: Tue Mar 15, 2011 6:39 am
Posts: 2
Fixed. It seems it was a problem with the first two ISPs that I was on. I tried a third one and I'm no longer experiencing the problem. They might have been doing something to the network late at night.

I added those options, awitko. Hopefully, if the ISPs start to go a bit crazy that'll keep it from disconnecting. Thanks!


Top
   
 Post subject: SSH disconnects
PostPosted: Wed Mar 16, 2011 2:42 pm 
Offline
Senior Newbie

Joined: Tue Sep 08, 2009 12:07 pm
Posts: 17
BTW, I do see smaller clientaliveintervals used, but I think this is the reason some observe that with spotty internet connections it may make matters worse. That is because if you send a clientalive every 20 seconds, for example, and you have the default maxcount at 3, then if the connection drops out for a minute (bad wifi, etc.) while the ssh was idle you will drop the ssh connection even if there is plenty of time left before timing out.

I think windows has a default timeout of 10 minutes for idle network connections so that is another constraint. I would think that could be changed by a regedit. I spread my clientalives over this interval. Now that I think about it might shave a couple seconds off the interval to make sure all five pings get in under the timeout period.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group