View Single Post
jldiaz's Avatar
Posts: 48 | Thanked: 40 times | Joined on Apr 2008 @ Spain
#50
Originally Posted by izzox View Post
Hi everyboy,
BRAVO!!! to anyone that contributed because there are really a lot of informations.

However, I had had a problem that I still can't solve by combining (SSH+VNC), even after I read the entire topic.

The following picture give a view of the situation.



I would like to remote, if possible, any computer at home from work.
using my tablet. thank you.

Note: I already fixed the problem using the combination (HAMACHI+ VNC), but I would like to use SSH because it is more secured.

The question is for everyone.
The problem is that 50.0.0.10 is the only IP visible "from outside" in your home. Then, the ssh connection from the Nokia should be addressed to this IP. But this will try to connect with the router, which is nonsense.

Routers have the possibility of redirect some port numbers to some other IPs (and port numbers). You can instruct your router to redirect any connection to 50.0.0.10:22 (standard ssh port) to, say 192.168.1.22:22. This way, when you try to connect via ssh from the tablet to 50.0.0.10, you will be actually connecting to PC-1

After this all should be easier. Once a ssh connection is got, you can create a ssh tunnel to any other PC at home. For example:

Code:
$ ssh -L5901:localhost:5900 50.0.0.10
Will create a tunnel to tablet's 5901 port to "localhost" 5900 port. In this context, "localhost" represents PC-1, so when you then launch vnc viewer in the tablet and connect to display :1, you will see the display :0 of PC-1

But this gets better:

Code:
$ ssh -L5901:localhost:5900 -L5902:192.168.1.23:5900 50.0.0.10
This creates two tunnels. The first was already explained. The second connects 5901 port in the tablet with 5900 port in 192.168.1.23 (this ip is seen "from the point of view of PC-1, which is the machine to which ssh is actually connected). This means that launching vnc viewer in the tablet, and pointing it to display :2, you will see the screen of PC-2

Note that you can even launch two viewers, one to display :1 and other to display :2, and see PC-1 and PC-2.

You can guess how to do for any other PC :-)

Note however that this solution allows you to connect via VNC to any PC, but not via ssh. As explained, the ssh connection is always received by PC-1. (Incindentally this means that you can remove ssh server from the other PCs). This also means that, when you connect to PC-2 to see its display, the VNC server of PC-2 is sending indeed the traffic to PC-1, which redirects it through the tunnel. This traffic from PC-1 to PC-2 is not encrypted (but I assume that your wifi is encrypted anyway).

A solution in which you make the ssh connection directly to the same PC in which you will plug the VNC viewer is also possible, but this means that you should configure your router to redirect a different port for each one. For example, let's say ports 2221 to PC-1, 2222 to PC-2, and so on. In this case, in the Nokia you should use option -p in ssh to tell which por you want to connect to. For example, ssh -p 2222 50.0.0.10 will connect to port 2222 in the router. If all is properly configured, this will be redirected to PC-2 and then you can login via ssh in PC-2 or in any PC. For this case the complete command would be:

Code:
$ ssh -p 2222 -L5901:localhost:5900 50.0.0.10
And then, vnc viewer on display :1 will lead to PC-2

I guess this is getting too confusing. Feel free to ask again.
__________________
--ル Diaz
 

The Following User Says Thank You to jldiaz For This Useful Post: