AutoSSH for a robust tunnel

Posted by Budric on Ask Ubuntu See other posts from Ask Ubuntu or by Budric
Published on 2012-07-31T21:50:10Z Indexed on 2012/11/15 11:25 UTC
Read the original article Hit count: 304

Filed under:
|
|
|

I'm trying to start an ssh tunnel from A to B and have it run despite things like: period network/wifi drops on A and remote server reboot on B. My ssh tunnel starts using upstart script on A with event start on (net-device-up IFACE=eth0)

I've found autossh which is supposed to handle these kinds of things, but had some trouble getting it to work. The upstart executes:

autossh -M 0 -2qTN -o "ServerAliveInterval 30" -o "ServerAliveCountMax 2" -L 5678:somehost:5678 user@B

However when I log into B and kill -9 that tunnel session, autossh just exits with "Connection to B closed by remote host." That's not what I expected autossh to do.

Any advice on how to set this up? Any GUI service monitoring utilities out there that essentially display a green light if a service is up?

Thanks.

© Ask Ubuntu or respective owner

Related posts about ssh

Related posts about upstart