Can the following be achieved with SSH.
There are three machines involved:
A. My local machine at home
B. The SSH gateway server at school
C. A workstation in a lab, only reachable through B
I want to setup a SOCKS proxy. I want to be able to surf on my local computer at home, like I am in the lab. This is due some sites that are only reachable from the school's public ip.
So I want to run a SOCKS proxy on host C. But I do not manage to make it work from host A.
I connect to the gateway and from the gateway I connect to the workstation. But I can't make the gateway transfer the traffic properly from and to the proxy.
How can I do this?
Best Answer
Three slightly different methods. (Replace $PORTX and $PORTY with port numbers of your choice.)
First method: ProxyCommand
Second method:
Connect from A to B, with "local forwarding" of
$PORT
tolocalhost:$PORT
.Connect from B to C, with "dynamic forwarding" enabled.
Configure your browser to use proxy at
localhost:$PORT
.Steps #1 and #2 can be summarized to:
Third method:
Connect from A to B, with "local forwarding" of
$PORTX
tomachine-c:22
.Connect from A to C over the tunnel, with "dynamic forwarding".
(You can omit
-f -N
if you want to use the same tunnel for interactive connections too.)Configure your browser to use proxy at
localhost:$PORTY
.