A Foxy Proxy: Local Port Forwarding via Firefox

You may, on occasion, find yourself tethered to an insecure network or behind a firewall that restricts passage to a website. If you have access to an external network and a configured client a-la a virtual private network (VPN), you can bypass these limits fairly quickly. But what if you don't?

Well, one option is a SOCKS 5 proxy tunnel. In brief, what this configuration does is establish a secure shell connection (SSH) to an external server, and then once connected, forwards traffic requests back to a designated proxy on your local machine. In effect, you browse as if you were on the external network.

To set up a SOCKS 5 proxy, you'll need:

  • a remote server configured to allow SSH access,

  • a local SSH client, and

  • the Firefox web browser installed locally.

Before proceeding, please remember that what follows are general guidelines. Your specific configuration could vary, and you may need access to your remote machine's IP rules/firewall/router, etc. That said, let's get started!

First, from your local machine, let's establish a connection:

ssh -D 1234 -f -C -q user@yourserver -p 1234 sleep 10 .

Broken down:

ssh initializes the secure shell utility;

-D binds the SOCKS protocol to the specified port;

-f forks the process in to the background;

-C compresses Internet traffic;

-q allows for non-verbose output to the shell;

-p is the SSH port that establishes the connection; and

sleep 10 will allow the process to run in the background once the Firefox browser is opened, ending when you close your browser's session.

Next, let's configure Firefox. From the browser, in the upper-right hand corner, open "Menu" and select Preferences:

.

Then, navigate to:

.

Select "Settings..." and then configure the proxy like this:

,

using the port you designated earlier when running the ssh command. You might also want to have your DNS resolution encrypted as well, in which case check off the appropriate box:
.
(Remember, you'll need to revert these changes if you want to return to browsing on your local area network (LAN) using Firefox).

Now, you should be able to browse your little heart out by typing in the web address of the formally blocked site.

Cheers!