6

I set up VNC server thanks to this tutorial but I realized that I can access to my r-pi only on the same network. So, I would like know how to access my r-pi while I am on another network and how to set a fixed IP for each r-pi I wish to monitor.

1
  • @all: thank you for your answers. I wish to have more r-pi to monitor and I thought to set a different fixed IP for each r-pi. Having said that, are still valid your solutions?
    – bit
    Feb 13, 2014 at 12:10

9 Answers 9

5

Having made a free account with VNC I am now able to connect securely to my Pi from anywhere, over the internet:

https://www.realvnc.com/en/raspberrypi/

I followed these instructions:

https://www.realvnc.com/en/docs/raspberry-pi.html#raspberry-pi-setup

see also here:

https://www.raspberrypi.org/blog/get-back-to-my-pi-from-anywhere-with-vnc-connect/

4

There are literally many ways for doing this for which what you need are static IP address and port forwarding on the router. Your condition may vary depending on what you have access to and on what side (client or server).

In my case, I had no access to the router and no static IP on both sides. But, I had access to a third-party server which I used for the connection. In short, here's what I used to do: VNC using third party server

I used ssh tunnel for port forwarding and a third computer with a static IP to solve dynamic IP related problem. If you have access to an ssh server, you can follow the procedure from this link.

3

For anyone looking to do this, take a look at this tutorial

How to Control a Raspberry Pi Remotely From Anywhere In the World

You basically install VNC Viewer on both machines and configure cloud sign in. This allows you to remote into your pi without having to enable port forwarding on your router. Additionally, you can access your pi from mobile devices since they have mobile apps as well.

2

This isnt a pi specific problem, but all pcs.

First of all, you have to own a valid IP address. If so, you can use port redirection to your pi.

If you have dynamic IP, you have to use some tool like no-ip.org to update your ip to a domain name, like yourdns.no-ip.org. Once you have one PC doing that, you could redirect one port to each pi, like yourdns.no-ip.org:9001, yourdns.no-ip.org:9002.

Again, it is not a pi specific problem, so may be you could search for dynamic DNS name and modem port forwarding to do what you want.

2
  • 1
    Why port 9001, and not 5901? Oct 9, 2016 at 23:28
  • 1
    The port numbers was just an example, you can make them whatever you like. Nov 7, 2016 at 3:21
2

You need to configure port forwarding on your internet router. I believe the default TightVNC one is 5901, though your config may be different. If you are unsure on what port forwarding is, see this http://www.howtogeek.com/66214/how-to-forward-ports-on-your-router.

Then you can use your external IP http://icanhazip.com and the port to connect to your VNC server.

3
  • For me icanhazzip.com shows a very odd number like it looks like 2611:245:8b8a:4312:4d1:ae9c:80ce:d195
    – CalebK
    Sep 14, 2023 at 6:14
  • that looks like an ipv6 address - see kinsta.com/blog/ipv4-vs-ipv6
    – nagyben
    Sep 15, 2023 at 20:25
  • Can you ssh to a ipv6 address?
    – CalebK
    Sep 16, 2023 at 0:07
1
  1. Discover your IP, I guess you already have it. (and your default gateway, what is the router port when there is no proxy)
  2. make sure that your Pi has an static IP (exact instructions will depend on your SO) -->example here
  3. Enter your router (in the browser enter you default gateway (something like 192.168.1.1) and make it forward your VNC port to your raspberry IP (usually port 5901) (in a section called NAT, enter a new entry to the table saying that port 5901 , both UDP and TCP will be sent to your local raspi IP (you know, 192.168.x.x)
  4. Follow this tutorial to get a fix domain name to access your raspi from the internet, and have your raspi updating his own public address when needed --> tutorial
1
  • I am using Google Synthetic domains, and am able to SSH into my RaspPi outside my house that way. However, I cannot connect to VNC that way... Oct 9, 2016 at 23:24
1

I realize this post is old, but thought I might have some useful info.

To connect to my pis via VNC on different networks and without port forwarding I use the website: https://www.remot3.it/web/index.html

You can make a free account, then, in the terminal of the pi, you can run the commands:

sudo apt-get update

sudo apt-get install connectd

sudo connectd

Then follow the steps in the installer and you can view and control all your devices (as long as they have a route to the internet, or even cellular) from anywhere. You can also follow this video once you have an account/the installer: https://www.youtube.com/watch?v=sHaY4EBQowQ

Full disclosure: I'm actually an intern at remote.it this summer, but I thought it might be useful for you.

1

Though this is an old post, I hope I can help someone else that is looking for a simple solution.

I found this platform a while ago - https://www.upswift.io

I use their Remote Access feature in order to connect to my rpi4 using VNC.

I basically followed this guide: https://www.upswift.io/post/remote-access-to-your-linux-iot-device-through-vnc?utm_source=remote-access-page&utm_medium=dashboard

Fun bonus - I also use their remote control if I just want to run quick commands in the shell (like restart my plex server)

0

You can use also other technologies, without opening ports on your router at all. I list some of them:

  • noVnc
  • Guacomole
  • ngrok

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.