how to check whether the ssh tunnel is up

Vincent Lin vintobe at
Sat Apr 27 21:47:34 EST 2013

Hi Daniel,

Is it the only way to check the tunnel on the remote server side? How about
on the local client side?


On Sat, Apr 27, 2013 at 2:22 PM, Daniel Kahn Gillmor
<dkg at>wrote:

> On 04/26/2013 05:06 PM, Vincent Lin wrote:
> > I use the command below to set up a ssh tunnel. And I run it as a daemon
> > process to keep the ssh tunnel work all the time. And I should wait for
> the
> > ssh tunnel to be up and notify the tunnel is OK before sending any
> command
> > to the remote port on the remote server. But the question is I don't know
> > how to check the ssh tunnel status. Is there a way to show whether the
> ssh
> > tunnel is up?  Thank you for your help.
> I recommend using -oExitOnForwardFailure=yes in such a configuration.
> You could also look into the various keepalive options (TCPKeepAlive,
> ServerAliveCountMax, ServerAliveInterval) to ensure that your process
> terminates when the connection is no longer established.
> This reduces your problem to ensuring that your daemon process is still
> running (and there are a number of good solutions for that sort of
> daemon supervision -- e.g. runit, daemontools, systemd, etc)
> Finally, you could test whether the tunnel is up by sending traffic over
> it and seeing if there is a response :)
> hth,
>         --dkg

More information about the openssh-unix-dev mailing list