0

I launched an autossh tunnel between a Raspberry PI and a VPS and it works. I'm testing whether it's reliable after the RPI internet connection drops and reestablishes.

What I did

  • Created an ~/.ssh/config and confirmed it's valid
  • Installed autossh and successfully started the tunnel defined in the above config
  • Unplugged the ethernet cable from my router, keeping the RPI Wi-Fi connection active
  • Checked netstat -tulpan on both machines; waited a few minutes
  • Plugged the ethernet cable back into the router

What was expected to happen

autossh re-establishes a working tunnel

What actually happened

autossh re-established a tunnel, but when I tried connecting to it from the other end, it gave me:

Unable to communicate with “my-host”. Make sure the remote computer is available and the firewall is not blocking screen sharing.

More info

After I took down the upstream internet connection, netstat on both VPS and RPI respectively showed:

tcp 0 0 VPS_IP:22 RPI_IP:41444 ESTABLISHED PID/sshd: admin

and

tcp 0 0 RPI_IP:41444 VPS_IP:22 ESTABLISHED PID/ssh

That is, same matching ports, and the status ESTABLISHED, even though RPI no longer had internet. Also, netstat on the VPS showed me the port I needed as being connectable (LISTEN), although the tunnel was supposed to be offline.

Once I plugged the cable back into the router, it showed the same situation on both ends, but with different tunnel ports now, plus the one I needed stayed the same.

Few minutes later, as I was writing this post, the port I needed has disappeared from the VPS, and it was only showing me the SSH connections (now two):

tcp 0 0 VPS_IP:22 RPI_IP:41878 ESTABLISHED PID/sshd: admin

tcp 0 0 VPS_IP:22 RPI_IP:41912 ESTABLISHED PID/sshd: admin

And the RPI netstat now looks like:

tcp 0 0 RPI_IP:41878 VPS_IP:22 ESTABLISHED PID/ssh

tcp 0 0 RPI_IP:41912 VPS_IP:22 ESTABLISHED PID/ssh

So apparently it restarted a tunnel (even two) but without port forwarding. Again, initially the tunnel worked. It's been 1 hour now and nothing changed.

I've seen this but the solution appears to be based on the netstat output, which in my case looks fine, but actually isn't working.

Your Answer

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

Browse other questions tagged or ask your own question.