1

This question already has an answer here:

I have a simple Flask http server running on my Pi that reports GPIO and controls some GPIO. While on my home wifi, I have no problem interacting with the RPi via the flask server using some Restful services on the RPi to turn on relays and get reading from GPIO pins.

I want to extend this functionality outside of my local Wifi now. I want to be able to hit the web server on my RPi from the internet even if I am half way across the country. Can someone point me in the right direction to do this?

My setup: I have my RPi on my home network. It is an Xfinity cable router running 250mbps. I can reach the internet through the RPi, I just need to reach the RPi to from the other direction now.

Thanks.

John

marked as duplicate by joan, Aurora0001, Dmitry Grigoryev, Community Mar 24 '18 at 23:41

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

The simplest route would be to use port forwarding. port forwarding is forwarding an internal lan(local area network, the network created by your router) ip address's port(for example, the port your raspberry pi's website is on) to your external ip address(the address you are given on the entire internet, not just locally.). this would make it so that you could access your website by typing your ip address into the address bar. you can do this by accessing your routers admin panel and setting up port forwarding, so it will be different for different routers. here is a nice guide. You will want to forward your pi's ip address, with the port your website is on. then you can access your website by typing your ip address(you can find it by searching for ip on google) into the address bar of a web browser.

be warned though: there are security risks to this approach, so make sure you research them first.

-2

it can be port forwarding with the public IP of your ISP, just be aware that most ISP use dynamic IP ( in that case you will have to update that IP in your modem again),but is you want to enter from local network, you can do port forwarding of your local IP, that will be only visible in your network

  • Thank you everybody for your answers. Does anybody know how providers like Cayenne devices uses their client to listen to traffic coming in and out so that the Raspberry Pi is accessible over the web? – john Mar 24 '18 at 23:45
  • @john , could you clarify about that comment? do you mean how are ip addresses accessible through websites like something.com? – scitronboy Mar 26 '18 at 15:43
  • No, I think what I am going to do is use flask.socketIO to create a websocket on the RPi to communicate with a central server. I can push notifications from the RPi via rest to notify users of changes, then they can use the web to connect to their RPi (which has a client listening using sockets) to turn connected devices on or off. – john Mar 27 '18 at 15:55

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