Windows HTTP tunnel through 2 Linux hosts?

The localhost only has connection to Host1. Host1 has connection to Host2 and localhost. How can I setup this to use Host2 as a proxy for web trafic from localhost?

I have seen similar topics but can't get it to work. How do I set it up on the Windows XP client?

alt text

EDIT:

this is the setup im using after following the post from Adam Batkin

alt text


Solution 1:

Here is an overview of what you want to do:

  • Firefox redirects all traffic to a proxy listening (locally) on port 9999
  • On Localhost, PuTTY listens on port 9999 and forwards any traffic from there across the open SSH connection to port 9999 on Host1
  • On Host1, ssh listens for connections on port 9999 and proxies any traffic across to Host2, acting like a SOCKS proxy

First, you will need to set up a tunnel to get from Localhost to Host1. This tunnel will just pass raw traffic across. Grab a copy of PuTTY on Localhost, set it up to connect to Host1, then in the menu on the left, go down to Connection, SSH, Tunnels. Enter a Source port (say, 9999) and destination (say, "localhost:9999") and hit Add. Once you are connected, PuTTY will be listening on port 9999, and any connections that it gets there will be forwarded across to Host, and at that point (from Host1) a connection will be made to localhost:9999 (i.e. Host1 will attempt to connect to itself on port 9999).

Next, we need to set up a proxy to get from Host1 to Host2. It turns out that openssh has one built in. From Host, run the following:

ssh -D 9999 host2

That will set up a SOCKS Proxy on Host1, listening on port 9999, which will forward all traffic to Host2.

The last step is to set up any applications that you have on Localhost to use "localhost:9999" as a SOCKS proxy:

  • Select Options from the Tools menu
  • Go to the Advanced page
  • Select the Network tab
  • Click the Settings button
  • Set it to "Manual proxy configuration" and enter "localhost" as the SOCKS Host and 9999 for the Port next to it

That's it!

(I've actually tested this, and it all works great.)