Is it possible to tell SSH to initiate a direct connection from a machine to another when the connection is passing through an intermediate SSH server ? I would like to do this to avoid the latency of the connection to be the sum of the latencies of the two tunnels.

Currently I have a SSH reverse tunnel from machine1 to machine2, because machine1 doesn't accept incoming connections, and only machine2 have a static IP. In order to access machine1 from machine3, the connection is passing via 2 tunnels, one from machine3 to machine2, and another from machine2 to machine1.

When I am connected, I would like the connection to switch from an indirect connection to a direct connection.

NOTE : I don't want machine3 to have an SSH server, only a client

Thank you for your help

1 Answer 1


SSH doesn't natively support setting up a port forward on a machine. It could be done with a custom script that configures the OS to forward packets from machine3's IP to machine1, and back. I would advice against the custom port forwarding method because it lack security, namely it vulnerable to IP spoofing, and properly also other problems.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .