0

I am trying to get my Arduino/ESP8266 project to work when I am off my local IP (192.168.xxx.xxx), similar to the way Shark and iRobot vacuums connect and can be accessed when not at home.

The vacuum examples do not use port forwarding to map an external IP to the local IP address, so I am trying to figure out how this works.

I am thinking I need to write a Windows service and pass the IP address from an Android or iOS app, but there must be a way to map the external IP to the IP of the ESP8266.

I am placing the ESP8266 in Station Mode, should this be in Host Mode?

  sendAndWaitForResponse("AT+RST", "ready", 100);
  sendAndWaitForResponse("AT+CWMODE=1", "OK", 100);
  sendAndWaitForResponse("AT+CWJAP=\"NETGEAR48\",\"cloudytree929\"", "OK", 100);
  sendAndWaitForResponse("AT+CIPMUX=1", "OK", 100);
  sendAndWaitForResponse("AT+CIPSERVER=1,80", "OK", 100);

In Host Mode, I could set the IP address and port, but it would still have to route through my router.

Any help regarding this is very much appreciated.

NickV
  • 549
  • 7
  • 17
  • 1
    Typically those sort of devices make a connection to an internet connected server. The app then also connects to that server and the server relays messages between the device and the app. Since both the device and the app make connections to the server, no inbound mapping is required – Paulw11 Sep 15 '20 at 20:31
  • I need to create a UDP server which will effectively punch a hole in the firewall as it calls my hosted service. Then I can use the reported IP address and port number to communicate with the IoT device. Problem is, my ISP is NATting my external IP address. I can see the true connection in my router, by My IP is returning something else. No big deal since I can manage that internally, but it really suck since it is a dynamic IP. I will have to ask about a statis IP from EPB, my ISP. – NickV Sep 15 '20 at 20:42
  • That isn't the approach that the devices you mentioned use. They create a TCP connection to the server and provide some sort of identifier (serial number). When the app makes a connection to the server you authenticate and you have the device serial numbers linked against your account. The app then sends a message to the server "have device X do Y". The server sends a "do Y" message down the appropriate TCP connection based on the ID X. Because all connections are outbound NAT isn't an issue (even multiple NAT) – Paulw11 Sep 15 '20 at 20:48

0 Answers0