Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm curious as to why my reverse SSH tunnel closes after a certain amount of time has passed while being inactive. Is this related to the specific ISP? I'm trying to reverse tunnel into a virtual linux box. I can connect remotely after killing the PID and then restarting autossh. This only works for about 10 minutes though.

I'd really appreciate any help!

Thanks

share|improve this question
add comment

3 Answers

Make sure the following are set in your sshd_config file on the machine you are tunnelling to:

TCPKeepAlive yes
ClientAliveInterval 30
ClientAliveCountMax 9999

These settings will make sure your connection is kept alive even when inactive.

share|improve this answer
add comment

Normally I don't answer a question with just a link. This episode of Hak5 explains reverse tunnels and addresses specifically why a reverse tunnel gets shut off, and what to do about it.

share|improve this answer
    
I will be watching this tonight. Thank you very much. –  Casey Aug 7 '12 at 23:36
add comment

A short timeout usually is related to some kind of time out set in a firewall or NAT device. The simple solution is just to pass the ssh option to set the ServerAliveInterval. Which just sends a periodic packet to keep the connection alive.

Host remote.example.org
    ServerAliveInterval 60  # 60 seconds sounds good?
    Hostname 192.168.1.1

Then just connect with ssh remote.example.org.

share|improve this answer
    
Thanks a lot! I did this along with 'ServerAliveCountMax #' where # is the amount of attempts to perform 'ServerAliveInterval' at which ever predetermined interval (in the example above, 60 seconds). –  Casey Aug 7 '12 at 23:35
add comment

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.