Wednesday 22 April 2009

Proxy without NAT

Useful for internet access from a second computer when NAT is not allowed (i.e. university dorms etc)

I think it's invisible as all requests are made and received by the computer that is connected directly to the internet (as if you were ssh'd into the machine itselft and looking at the traffic in your terminal or over an X forwarding session, but without the graphical information being forwarded over the network). A downside to this approach is that is a pain in the arse getting it to work with apt-get etc. (Which I haven't bothered doing yet). I believe you can 'socksify' your system with tsocks or something similar.

I have a laptop and a desktop. The desktop is connected to the ethernet supplied by the university and the laptop is connected wirelessly via a router to a second ethernet card in the Desktop machine.

You need sshd running on the desktop machine for this to work.

On the laptop I run

ssh -D 8080 user@desktop

And then in Firefox (or any other application) you point it to local port 8080 (on address 127.0.0.1) under
Edit -> Preferences -> Advanced -> Network -> Settings -> Manual Proxy Configuration

The SOCKS Host is 127.0.0.1, port 8080 and you need SOCKS v5 (assuming you are running a suitably new version of ssh)


I have a script in my home directory called getnet :

#!/bin/bash

nohup ssh -D 8080 -N user@desktop > /dev/null 2>&1 &


Which with key exchange set up (see post) means that I can call it from a run dialog without entering a password.

No comments:

Post a Comment