Tunneling

From Jan Prunk
Jump to: navigation, search
Tunneling over SSH



Why would you want to tunnel over SSH? One great reason is to encrypt all your internet traffic (to a certain point). Great way to protect yourself against peeping toms (packet sniffers) at your local coffee shop!


Windows

Tools:

    Putty (SSH Client)

Configuring Putty

- Launch the Putty Client once you have downloaded and installed it
- Enter the host name and port number of the host you wish to connect to
      Example:
          Host: gnu.mtveurope.org
          Port: 422
- Expand the "SSH" category under "Connection"
- Select the "Tunnels" category and enter the following information
- Enter a port number in the "Source port" field. Pick one that is not already in use!
      Example:
          Source port: 7070
- Select the "Dynamic" radio button and hit "Add"
- You should now see "D7070" (or D[whatever port number you picked]) under the "Forwarded ports:" field
- Go back to the "Session" category
- Give the session a name under "Saved Sessions" and hit "Save"
- You will now be able to double click on the saved session to connect over SSH
      • TIP: you can add your user name followed by the "@" before the host name to avoid typing your user name every time you connect!
      Example:
          Host: user@gnu.mtveurope.org

Configure program to tunnel In this example we will be configuring Firefox to send/receive all traffic through the SSH connection (Encrypted). The same can be applied to pretty much any program (AIM, Thunderbird, IE, etc.).

- Launch Firefox Options. This should be under [Tools > Options] (Windows) or [Firefox > Preferences] (OS X)
- Select the "Advanced" option then the "Network" tab
- Select the "Connection" box (this should open a new window with proxy options)
- Select the "Manual proxy configuration" radio button and enter the following information 
      Example:
         SOCKS Host: 127.0.0.1
         Port: 7070
- Select the SOCKS v5 radio button and hit "OK"
    • 127.0.0.1 is the ip of your localhost. The Port number should be the same as what you configured in Putty under the "Tunnels" category

Everything is all set! Just exit and reopen Firefox and all traffic should be tunneled to the SSH server. You can apply the same settings to most other programs. Just find the network options for setting up a proxy. Enjoy!


Unix (Linux, OS X, etc)

Tools: None! openSSH is included in most Unix systems!

Configuring openSSH

- Launch Terminal
- Enter the following:
           ssh -D [local port] -p [server port] [user]@[host]
       Example:
           ssh -D 7070 -p 422 tempusr@gnu.mtveurope.org
- -D [local port] is the local port. You can change that to whatever you like
- -p [server port] is the server port. Change that to whatever port the SSH server is on
- Configure your Applications (See "Configure Program to Tunnel" above)
- That's it!


Enjoy!

- Shaun

Comments:

Thank you Shaun for writing this manual ! yang 10:36, 26 September 2008 (UTC)

INTERESTS
Personal tools