I have a Pi that connects to the internet via a 3G dongle. I need to be able to remote desktop/VNC to this Pi from my home network. Is this even possible, and if so, how do I go about doing this? Obviously the Pi isn't "on-site" yet and I still have physical access to it, I just need to know how to set it up.
-
What other computers do you have on your home network? Windows, MAC or Linux? Or all of the above? Have you looked into using OpenVPN to have the OpenVPN client on your Pi VPN into the OpenVPN server running on one of your home computers?– HeatfanJohnCommented Apr 30, 2014 at 20:10
-
I would like to use a Windows computer, however I have machines with all 3. I haven't looked into OpenVPN yet. Would having the Pi connect to the OpenVPN server on my home network allow me to control the Pi like I do locally with remote desktop?– Rob_IGSCommented Apr 30, 2014 at 20:29
-
An alternative to VPN would be a relay service like PageKite or Yaler.net– tambergCommented Feb 17, 2016 at 11:36
1 Answer
My first idea was to use OpenVPN client and OpenVPN server to have your remote Internet connected Raspberry Pi VPN into an OpenVPN server on your home network. However after reading some of the details to get this working I decided to look for a more simple solution.
I found this article that shows how to use OpenSSH installed on the remote Raspberry Pi to SSH into a machine on your home network and then have your home computer create a local TCP port (2222 in the example) that would automatically get forwarded to the SSH port (22) on the Raspberry Pi.
Here's another article that describes the same process and even shows a recommendation to have a CRON job create the SSH connection from the Pi every 10 minutes in case the connection every breaks.
Of course, the computer on your home network needs have an SSH daemon installed and your home firewall needs to allow that computer to receive in bound connections. You should be able to easily configure your home firewall to forward some unused TCP port such as 9099 and forward that to port 22 on your SSH "server" on your home network. Then you would need to use that port with the -P
option on the SSH command running on your Pi. For the 2nd article the ssh
command would be:
ssh -N -P 9099 -R 9091:localhost:22 user@<server_IP>
Where <server IP>
is the Internet address of your home firewall.