It could be a typical port forwarding case, but it is quite confusing for me. I have a machine A which has to connect to C. I can't edit any settings in A, except the destination it has to connect to. It can't connect to C directly due to proxy issue. I want machine B to be setup in such a way that it can listen for an incoming connection from A, and forward to a connection to C. C doesn't like a dedicated connection, so B should establish a connection to C only after A requested one. I can't edit the settings in 'C' either. Any help on how to do this would be great.

link|improve this question
feedback

1 Answer

up vote 1 down vote accepted

Is this what you want?

# on b's 192.168.0.2 interface, listen for incoming connections on port 2525
# and forward them to c's localhost on port 25 (assumes b has an interface with
# an ip address of 192.168.0.2 and c is listening for ssh connections on port 
# 25).
user@b$ ssh -L 192.168.0.2:2525:localhost:25 user@c

# on a, ssh to b's 192.168.0.2 interface on port 2525, this will be forwarded
# to c on port 25.
user@a$ ssh -p 2525 user@192.168.0.2
link|improve this answer
Thanks for trying to help. No I can't do anything to A, except specifying the actual hostname and port number it can connect to. A has an application with an inbuilt ssh client, which doesn't obey the ssh config settings – user53055 Oct 22 '10 at 13:28
feedback

Your Answer

 
or
required, but never shown

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