There is one computer (A) in one local network and the other (B) in the other one. None of them have public ip addresses. Both LAN gateways are out of my control. But I have a VPS server with public IP address and both A and B are able to connect to this VPS. How can I establish an ssh tunnel from A to B using intermediary VPS?

有帮助吗?

解决方案

Connect from B to vps forwarding remote port to local side (seem -R ssh option):

B# ssh -R 2222:localhost:22 vpsuser@vpshost

this will connect you to VPS host making port 2222 on server connected to B host port 22 (ssh) Only thing left to do is to connect from A to VPS server and from it to B via 2222:

A# ssh vpsuser@vpshost
VPS# ssh -p2222 buser@localhost
B#
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top