Foreword
I needed a way to get inside my work firewall from home. There was a DMZ linux machine that I could SSH to, but no VPN available. What I really needed was a way to configure the router/firewall, but the only way to do that was to be on the internal network and browse to it using a browser. Trying text based browsers didn’t work, the only way to access and administer the router was to use a full featured browser from behind the firewall itself. To make a long story short, I figured out how to do it using Putty and Firefox, and this is how you do it.
Getting Started
First things first, make sure you have Putty and Firefox installed. Next you’ll want to be able to establish an SSH connection to a remote server using Putty. For example, launch putty, enter the host name or IP and make sure you can connect and login. Once you have that, you’re ready to setup the SSH tunnel and browse through it.
Configuring The SSH Tunnel
Now open Putty and Enter the hostname or IP of the machine you want to establish a remote connection to. Next under Connection->SSH->Tunnels find the radio boxes under the Destination field and make sure Dynamic is selected. Next under where it reads Add new forwarded port: enter a source port. For this example lets use 1024, enter this in the source port field and click the Add button. You should see a value in the Forworded ports: list that reads D1024. That’s all there is to the Putty side of things. Next go back to the session area and save the current configuration as a saved session if you’d like, then Open the SSH connection.
Configuring Firefox
Now, launch Firefox, select Tools->Options and click the Advanced tab. Within the Advanced tab, click on the Network tab and click the Settings button.
Within the Network Settings dialog, select the Manual proxy configuration radio button and enter the following for the SOCKS Host: and Port:
SOCKS Host: localhost
SOCKS Port: 1024
Click OK on the Settings dialog, then Click OK on the Options dialog. Now you should be good to go. Enter a new URL in the Firefox address bar and you’ll be browsing from the remote end of the SSH connection.
What I have to do, if I want to use port 2222 instead of 22 for SSH connection?
My enviroment:
remote ssh server on 22 behind firewall NAT from 2222 to 22 (I could work on SSH from remote on 2222).
When I try to tunnel my browser with proxy setting on that ssh (2222) using dynamic port on 17222 it does’nt work. It works if I use 22 on remote system.