Are you faced with a situation where by you don’t have direct access to a desired server (because of a firewall, ACL, or VLANs), yet you wish to access a service (say http on port 80) running on that server? The good news is that you can use an intermediate server (which you have direct access to) to establish a logical connection to the desired server and get that service running on your local PC as thou you were connected directly to the server.
In this case the intermediate server will act as a proxy server and will forward any connections coming from your local PC to the desired server through the configured ports. Here is a step by step guide on how to make port forwarding work with PuTTY.
|SSH Port forwarding using PuTTY|
In order to use port forwarding to connect from your local machine to a port on a remote server, you need to:
1. Open your PuTTY SSH client, Under Category: Session, Enter the IP address of the proxy server (e.g. 192.168.20.30), enter a session name if you like (e.g. My_Proxy) and click “[Save]”. Select the session name (My_proxy) and click “[Load]”.
2. Under Category: SSH > Tunnels, check “Local ports accept connections for other hosts” and also check “Remote ports do the same”. Enter the source port e.g 2000, Enter “Destination” IP and Port separated by a colon (e.g. 192.168.20.50:80) and click “[Add]”. The details of your port forwarding should appear in the list box.
3. Go back to category: Session and Click “[Save]”. Click “[Open]” to start a SSH session to the proxy server. Provide the required credentials; username and password.
4. Once you have successfully logged in your “Proxy” server, open your browser and enter the URL as below: http://127.0.0.1:2000/
5. You should without fail be able to access http service running on the remote server as if you had direct access to that server. What is happening is that PuTTY listens to all connections on your machine coming in through port 2000 and forwards them to the proxy server which in turn forwards them to the remote computer. So you have a logical connection between your local PC and the remote server.
6. Have fun, you are now free from those firewall policies and ACLs that were denying you access.
Download PuTTY Here:
Download PuTTY Here: