I have the following network:
___________ ___________ ===========================
| HostA | | HostB | || www.internetservice.com ||
|-----------| <===== |-----------| =====> ||=========================||
|10.11.12.13| |66.77.88.99| || 151.141.12.10:123 ||
|___________| |___________| ===========================
HostBcan access toHostA(e.g.ping 10.11.12.13succeeds)HostBcan access to thewww.internetservice.comon151.141.12.10:123(e.g.telnet www.internetservice.com 123andtelnet 151.141.12.10 123succeed)HostAcannot access toHostB(e.g.ping 66.77.88.99fails)- and of course
HostAcannot access towww.internetservice.comon151.141.12.10:123(telnet www.internetservice.com 123andtelnet 151.141.12.10 123are also failing)
Of course what I want is to make the the Internet on 151.141.12.10:123 available from HostA!
I already have a solution but it doesn't quite suit me; I wish I had something better. My solution is to create from HostB, a reverse SSH tunnel on HostA to the InternetService:
myuserB@HostB:~ ssh -N -R 123:www.internetservice.com:123 myuserA@HostA
Doing so, myuserA on HostA can open a connection to www.internetservice.com:123 by running:
myuserA@HostA:~ telnet localhost 123
This works fine; almost perfect... except that I would prefer to run
myuserA@HostA:~ telnet www.internetservice.com 123
or at least
myuserA@HostA:~ telnet 151.141.12.10 123
In order to obtain what I want, I tried (in vain) to initialize the SSH tunnel by running
myuserB@HostB:~ ssh -N -R www.internetservice.com:123:www.internetservice.com:123 myuserA@HostA
I also tried
myuserB@HostB:~ ssh -N -R 151.141.12.10:123:151.141.12.10:123 myuserA@HostA
but when doing so, I am not able to telnet neither www.internetservice.com:123 nor 151.141.12.10 123 from HostA
Any idea about what I should do?