I'm gettin a headache trying to access a remote VLC & SSH. This is the situation :

Local : Win box behind NAT, dynamic IP. I want to connect from here.

Hop : Linux box, static IP server

Remote : Linux box behind NAT, dynamic IP. I want to connect here

As the remote has dynamic IP and is behind NAT, I make ssh reverse tunnels to the hop :

ssh -R 55900:localhost:5900 -R 50022:localhost:22 user@hop

This step seems to work. From the hop, I can ssh the remote connecting to localhost port 50022 :

ssh -p 50022 user@localhost

Then from the local, I make ssh tunnels to the hop, with putty : Making tunnels

Once the second tunnel is made on local, when I try to reach the remote SSH or VNC, the connection is straight closed. For SSH (via another instance of putty), I get the error "Server unexpectedty closed the connection" For VNC (TightVNC Viewer) : "Connection has been gracefully closed"

I tried to change some putty options after looking for solutions on the web, as "enable X11 forwarding", or "Allow agent forwarding", but without success.

Any idea of how to solve this?


1 Answer 1


Well... first I'll answer with a different question: Since you can hit the ports you need on HOP from LOCAL, why not just have TightVNC Viewer connect directly to HOP:PORT? From a connectivity perspective, you shouldn't need to.

Second (answering your original question), if you want to make sure that you're encrypting the session the entire way (completely reasonable) then I get why you want to use from LOCAL to HOP. First, on HOP, please run netstat -an | grep 55900 and note what IP address the server is listening on... if it's or localhost, you'll need to make sure that you put LOCALHOST as the "remote" part of the tunnel spec in putty. If it's some other IP address, use that. If it's * or then just use localhost.

EDIT: I just noticed that you use "localhost" in your -R tunnel spec from REMOTE. This is almost certainly the source of the problem if you're not also using localhost in your putty config.

Next, on REMOTE, please run netstat -an | grep 590 (not a typo, really 590) to make sure that your VNC software is listening on 5900 as expected... sometimes it's on 5901, and it's important to remove this as a possible problem source.

If that doesn't clear up your issues, let me know....

  • Sorry for late answer. Indeed, it was juste the putty destination that was wrong. Has to be localhost:port (in my examples localhost:55900 & localhost:50022) in place of the public IP Commented Oct 24, 2014 at 7:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .