SSH Tunnel HowTo
by heathenx.



This tutorial is basically a Windows tutorial because I use a Windows XP box at work to connect to my Linux box at home. Several people have asked me how to do this so I wrote a quick tutorial. This kind of how to can be found all over the net. It's rather easy. From Linux to Linux see the last line of this how to.

I'm assuming that you already have and know how to configure a computer as an SSH server. I won't go into detail with that. It takes only a few minutes to set up.

The basics:

1. A server where openssh is running (I'm using openSUSE 10.1 as my OS at home)
2. PuTTY
3. Firefox

Step 1:
Configure putty for an ssh session to your server.


Step 2:
Configure a secure tunnel

a. Click tunnels
b. Under “Add new forwarded port” type 7070 (or any port number).
c. Click Add Button

Step 3:
Connect to your remote host (double click your connection profile)

Step 4:
Configure Firefox to use your proxy

Step 5:
Ensure that your DNS request also goes through your proxy.

a. In Firefox open the about:config page (put about:config in the address bar).
b. Change network.proxy.socks_remote_dns to true (without this the names of any sites that you visit can get logged. with it that information will be protected).

Note: You must keep PuTTY open and connected if you want access to the Internet. Try killing PuTTY and see what happens...

Portable versions of Firefox and PuTTY are available (as well as Thunderbird and Gaim) for use with USB jump drives. Use this option if you cannot install anything on the client computer. This could be handy if you were at school lab or something.


On a Linux host you could to the following:

ssh -qTfnN -D 7070 hostname.org (instead of using putty).

-q :- be very quite, we are acting only as a tunnel.
-T :- Do not allocate a pseudo tty, we are only acting a tunnel.
-f :- move the ssh process to background, as we don’t want to interact with this ssh session directly.
-n :- redirect standard input to /dev/null.
-N :- Do not execute remote command.