Passing all traffic through SSH in Ubuntu

When using the Internet in an unsafe place, such as a public wireless network, you might want to encrypt all the traffic that you send and receive. To do that, you could use a remote SSH server to which to create a SSH tunnel, and configure applications to use a SOCKS proxy.

To create a SSH tunnel to a server, run:

ssh -fCND user@host

This will connect to the SSH server, go in the background and listen on the local interface for SOCKS connections to port 1080.

Now that you have a SOCKS proxy listening on, port 1080, you can configure any application that can use a SOCKS proxy to use it. To do that globally in Gnome on Ubuntu, you can go to System » Preferences » Network Proxy, specify the SOCKS host and port, and select "Apply System-Wide…".

If you're a Firefox user and also want to send DNS requests through the SSH tunnel, you can go to about:config and set the following property to true: