LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   setting up ssh tunnel for vnc (https://www.linuxquestions.org/questions/linux-networking-3/setting-up-ssh-tunnel-for-vnc-375406/)

jr0 10-21-2005 08:29 AM

setting up ssh tunnel for vnc
 
hello. i want to set up a putty ssh client in a way to tunnel a vnc connection. i want the computer with putty to act as a vnc server. How do i set up the tunnel?

Port 5900, etc...

i know that if i want the putty computer to act as a vnc client, i have to set up the port 5900 and destination "localhost:5900" with option: local

But this doesn't work for being a server...

thanks

Hangdog42 10-21-2005 11:16 AM

The first thing you have to know is the screen number your vncserver is running on. That is usually :1, but not always. The reason you need to know this is because the server is listening on port 5900+screen number. So to connect to screen :1, you need to tunnel port 5901 and to listen to screen :2, you need to tunnel 5902.

Then to connect through Putty, you usually need to connect to localhost:screennumber. so localhost:1 for screen 1.

jr0 10-22-2005 09:37 AM

I know that port settings. My only question is how to configure putty-tunnel:

When i configure the putty machine as a vnc client, i configure the tunnel like:

Port: 5900
Destination Port: localhost:5900
and a "x" on local.

Then i type in vncviewer: localhost:5900 and it works.
Now if i want to do the opposite, how can i configure it? I guess my "x" will be on remote... Then, i guess the port will be the same or 5901 or 5902... ok. And what about the destination Port? also localhost:5900 or the ip address from the ssh-server that wants to run a vnc viewer? and on the ssh server which runs the vnc viewer: how do i configure the vncviewer? on localhost or on serverīs ip?

Thanks again.

Hangdog42 10-22-2005 11:38 AM

OK, I think I know where you're confused. Lets assume that vncserver on the remote box is on screen 1, so we're using port 5901. In Putty, you want the local port to be 5901 and the remote port to be 1.2.3.4:5901 only replace 1.2.3.4 with the LAN IP address of the remote machine.

So on my network, I have an IP address from my ISP (the WAN IP) and my Linux box has an LAN IP address (192.168.1.50) that is non-routable. So to make the SSH connection, I connect to the WAN IP address (which is forwarded to my Linux box) but to make the tunnel I use the LAN IP address. So on my Putty, the Destination port is 192.169.1.50:5901. If the ssh connection is OK, I then fire up a VNC client (on the local machine) and point it at localhost:1 and the connection is made.


All times are GMT -5. The time now is 01:40 AM.