Quantcast
Channel: sshnet Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1729

New Post: How to detect a tunnel disconnect?

$
0
0
Sorry, I don't know your setup, especially which machine you meant with "linux machine"...

The remote forwarding is started on the linux machine, so it is the job of the ssh server to manage the tunnel.

If you disconnect the server, the ssh connection is kinda still there till timeout, which depends on your ssh server config AFAIR.
Then the server will close it's sockets, including your forwarding.

There is no way the client can see whats happening on the server without having a connection to it.
Cause there is no socket on the ssh client side for remote forwarding. It's all happening on the server side.

I can easily reproduce this with OpenSSH
ssh -R 2222:test1:22 test2 -l root

# netstat -ant | grep 2222
tcp          0      0  127.0.0.1.2222         *.*                    LISTEN
tcp6         0      0  ::1.2222               *.*                    LISTEN

# ifconfig em0 down
Connection hangs, but tunnel on 2222 is still there on test2
# netstat -ant | grep 2222
tcp          0      0  127.0.0.1.2222         *.*                    LISTEN
tcp6         0      0  ::1.2222               *.*                    LISTEN
Wait a few seconds, and up em0
# ifconfig em0 up
# netstat -ant | grep 2222
tcp          0      0  127.0.0.1.2222         *.*                    LISTEN
tcp6         0      0  ::1.2222               *.*                    LISTEN
Same ssh connection still works.

Viewing all articles
Browse latest Browse all 1729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>