Sometimes you need to configure something on your client office (router/firewall), but the only way to do that was to be on the their 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. There was a DMZ linux machine that I could SSH to, but no VPN available. I figured out how to do it using Putty and Firefox, and this is how you do it.
What you need?
- Firefox browser.
Configure SSH tunnel using Putty
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 696, enter this in the source port field and click the Add button. You should see a value in the Forwarded ports: list that reads D696. 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.
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: 696
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.
I AM A LINUX GEEK (or MAC BOY)! I don’t have a Putty kind of thing, then how?
So geek, this is what you need?
- Firefox browser.
Configure SSH tunnel using terminal
Launch your terminal and run;
# ssh -D 696 -f -C -q -N email@example.com
Verify that the tunnel is up and running with this command:
# ps aux | grep ssh
You should see a line in the output like:
root 14345 0.0 0.0 2462228 452 ?? Ss 6:43AM 0:00.00 ssh -D 696 -f -C -q -N firstname.lastname@example.org
You can quit your terminal application and the tunnel will stay up. That is because we used the -f argument which put the SSH session into the background.
Note: If you want to terminate the tunnel you’ll have to grab the PID via ps and use the kill command, example kill -9 14345
Now scroll up and follow the step how to Configure Firefox. and start browsing.