In my home network I have a PC, raspberry pi, macbook and a few other devices which I want to access away from home.
As it stands, I have setup VNC server on my PC along with remote desktop and have changed the default ports. These ports are open on my router and redirect to the PC so that I can access them via dynamic dns.
However I was wondering if it was possible to close those open ports on the router, and instead leave only port 22 on the raspberry pi so I can use an SSH tunnel through the pi, to the PC and run VNC through that?
If so how would the command prompt look? I understand vaguely how SSH tunnels work and can use them applying to 1 remote host, i.e:
ssh -L 22222:localhost:5900 user@pi
then running localhost:22222
in my vnc viewer will let me connect to the pi.
Reading up on the subject suggests I could do something like ssh -L 22222:internal_pc_ip:5900 user@pi
and run localhost:22222
like before?
Can I do this?
-L
in your ssh command to establish tunnel.