I have configured an SSH tunnel to forward my web traffic from hostA to hostC using this command on hostA:

    ssh -D 2222 user@hostC

after configuring my browser to use a proxy on port 2222. This works great. However, I now want to forward the same traffic through an intermediate SSH connection on hostB in order to get to hostC.

I tried this on hostA:

    ssh user@hostB -L 2222:hostB:22

but I get "channel x: open failed" errors. Does anyone know the correct way of doing this?

migrated from stackoverflow.com Oct 31 '12 at 22:35

This question came from our site for professional and enthusiast programmers.


On hostA:

ssh -L8080:localhost:22222 user@hostB

On hostB:

ssh -D22222 user@hostC

Then on hostA you can use localhost:8080 as SOCKS5 proxy.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy