I'm using a reverse SSH tunnel on Debian with openssh-server and autossh: something like -R 1234:localhost:22 with a monitoring port also set.

Generally, it works well, but I'm having the following problem: the tunnel opens and I see my remote server listening on But as soon as I try to establish a connection to this address:port, I get a "Connection refused" message and the port closes until autossh reopens it.

I have another tunnel, a -L. It sends its logs to this remote server. This tunnel seems to work as I'm receiving logs.

Anyone would have an idea of what's happening?

  • do you have anything like a misconfigured snort or failban or iptables rules that could get in the way? Do you have a service already listening on 1234? Your -R command is definitely good so there's something else getting in the way. – zmo Mar 5 '14 at 20:41
  • Looking at the informations I have now, it looks very strange. This machine opens a few tunnels: -D (socks), -L (local) and -R (remote). All the -R tunnels won't work. I already ran some tests with fail2ban off or iptables ... – user305368 Mar 5 '14 at 20:47

After a while, I thought it was a bad network cable: the tunnel opens but as soon as there is more trafic on it, it falls.

Actually, I wasn't so far: the device initiating the tunnel had the same IP than another device. The connection was not stable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.