Assume I have 3 servers: A,B and C

C can ssh to both A and B but A and B can't connect to eachother.

Is it possible to open a tunnel between A and B using C as in "intermediary" without proxying all my traffic through C ?


1 Answer 1


If A and B can't connect, then the traffic will have to go through C. You want to run (on A):

ssh -L A:portA:B:portB user@C

While that would usually be run directly on A, perhaps you can run it remotely from C (but I don't have a 3rd machine to check):

ssh user@A "ssh -L A:portA:B:portB user@C"

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.