Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

This keeps hapenning on which ever server I am connected to. I type:

ssh user@server

I log in, everything works for a couple of minutes. But after some time, possibly when I switch to other programmes (browser, ftp client etc) when I try to type anything back in the terminal, the cursor stops blinking while I type, but nothing actually gets typed. I can't execute any command, and all I can do is close the terminal window, reopen it and reconnect.

If it's of any importance, I'm running Ubuntu 12.04 on my local machine.

share|improve this question
    
Many (cheap) NAT routers will drop idle connections. How quickly depends a bit on how busy they are and the size of their buffers. You may mitigate the problem somewhat by enabling TCP keep alive in your SSH client as well as the configuration of the SSH daemon. –  HBruijn Jul 9 at 14:59

1 Answer 1

up vote 2 down vote accepted

You have a NAT router or a similar stateful firewall between your client and the server. When you opened the TCP session, the firewall remembered that a TCP connection was created between your client port and the server port. As long as the firewall remembers the connection, it will continue passing packets between the client and the server.

The session "breaks" because the firewall forgets about the connection and stops passing packets through. The firewall may forget about the connection because it has a timeout on idle connections. Or it could forget because it has a limited amount of memory and too many new connections were being created for it to remember all of them.

ssh has some options to work around this by sending periodic "keep-alive" packets when the connection is idle. Look at the TCPKeepAlive, ServerAliveInterval, and ServerAliveCountMax options.

share|improve this answer
    
Thanks Kenster for taking the time to explain it to me. I'll see if the options you've mentioned will help. –  Томица Кораћ Jul 9 at 15:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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