Using tunnels with SSH is a powerful method to access services on systems behind a firewall or that are otherwise inaccessible. In this example, a VNC client on your local computer will connect to a remote VNC server (vncserv.tech-recipes.com:0) using port forwarding with an SSH connection to another remote host (sshd.tech-recipes.com).
On your local system, start putty and in the configuration window click on Tunnels under the SSH menu. For each VNC port you want to forward, you need to add a Local forwarded port.
By default, VNC screen :0 uses port 5900/tcp, screen :1 uses 5901/tcp, etc.
For each port you want to forward, in the Port forwarding section enter:
Source port: 5900
Destination: vncserv.tech-recipes.com:5900
and click Add. This will add it to the list of forwarded ports. Repeat as desired although only one port forwarding is required to use VNC. Because this is a local forwarding, the source port can be accessed later as localhost:5900. It is valid for the VNC server to be the same system you are connecting to by ssh. In this case, you can use either the name of the remote host or ‘localhost’ in the destination field.
In the Sessions configuration screen, specify the host name (sshd.tech-recipes.com in this example). You can name and save this configuration from the Session screen. This will save time if you want to use this configuration again in the future.
When you are ready, click Open to connect to the remote system and create the session. Once authenticated, the ports will be forwarded and you can connect your VNC client to localhost:0 (or whatever screen number appropriate) and you should be good to go.