This is something Advanced level so if you are a beginner, try to follow along and I will try to explain it in the easiest to understand way.
Why do we need SSH tunneling? Well, for me it makes it quite easy to manage the services from my private network to be available from the internet. All I need to do on my firewall is open or forward an open port to the SSH listening port on my SSH server. If you want to setup your SSH server, you may want to take a look at my other post.
In this post I will try to explain how to use RDP over SSH Tunnel. The idea is to access the RDP service on a Windows host from another computer without connecting to the RDP service port (by default 3389) using a SSH tunnel provided by an SSH server.
I am using PUTTY here.
On the Client, open putty and scroll down on the left side and click on the + sign next to SSH to select Tunnels. Enter a port number higher than 1024 here which should not be same as any other running service on your (client) computer. I chose 2222 here and then enter the ip address of the host computer where you want to connect through tunnel (10.0.0.100 port 3389 providing RDP in our example) then click ADD.
Now it should appear in the box above so scroll up on the left and click on Session.
Now enter the ip address of the SSH server (10.0.0.2 and port 22 in our example) and click on OPEN.
- In the terminal window which just opened, enter the username and password for the SSH Server and keep it open.
Now open mstsc.exe on your computer and use the localhost as the ip and 2222 (the one we chose in step 1) as the port and click on connect. You should see the login window and that’s it.
Just remember to keep the Putty window open else the tunnel will drop and you will have to re-establish the connection. Have fun.