SSH tunnel hanging

sshssh-tunneling

I'm trying to use an SSH tunnel from home trough a computer in the university so I can access some articles.

Both machines are running Ubuntu 11.04. The university's machine runs openssh-server.

At home I followed these instructions:

  1. open an ssh session:

    ssh -D 9999 -C user@my_addr.com 
    
  2. Then I configured Firefox to user SOCKS5 connection on port 9999 of localhost.

This works for some time. Then, it suddenly hangs the connection and the terminal just freezes.

What am I missing here?

Best Answer

You can try setting the ClientAliveInterval and ClientAliveCountMax variables in your sshd config file to values that suit you.

From the manual:

ClientAliveInterval 

Sets a timeout interval in seconds after which if no data has been received
from the client, secshd will send a message through the encrypted channel 
to request a response from the client.
The default is 0, indicating that these messages will not be sent to the 
client. This option applies to protocol version 2 only.
Related Question