I have setup a ESP32 board to receive and send data from/to Ubidot brokers. I have tested the boad and the program with the board connected to a local network behind a router allowing port forwarding and with a public IP address (dynamic but accessible through services like NOIP). Everything was ok, even without any port forwarding rule related with Ubidots connection.
Then I have moved the board to the local network in my vacation home, with a 4G router and a local network behind, so, CGNAT, with no port forward capability and with no public address accessible. Communication with Ubidots is no longer working.
When moving the board I had the hope that Ubidots software would implement some sort of reverse tunnel allowing the communication with Ubidots even if the client was on a local network behind CGNAT. But clearly this is not the case. I have implemented from my side a ssh reverse tunnel through which I can access through ssh the board in my vacation home network, but I have not set up (yet) any reverse tunnel to communicate with Ubidots broker.
Has anybody faced a similar situation and solved the communication problem of a client behind CGNAT and Ubidots broker ? This is something that many IOT applications will have to overcome to run on remote sites without “normal” internet access.
There seems to be a few possible issues that could be causing this behavior.
I’d suggest checking the following:
According to this documentation, depending on the ESP32 chip version that you hold, it might only support 2.4GHz WiFi networks. So a first approach should be checking that both the ESP32 SoC as well as the 4G router at your vacation home, use the same frequency.
Check that you have internet connection and can reach our servers through the 4G router. You can try the following commands:
ping industrial.api.ubidots.com
telnet industrial.api.ubidots.com 80
curl -X GET https://industrial.api.ubidots.com/api/v1.6/utils/utcnow/
If any of the above fails, then the problem lies on the connection to our servers.
This is a long shot but, make sure about the encryption type compatibility. You can set the same password on your vacation home router as in your non-vacation home router. The ESP32 supports WFA, WPA/WPA2 and WAPI, however it is best to check this.
Thanks very much for your reply. The solution to my problem has ended to be much more simple (if not stupid) than what I expected: when changing from one local network to the second one I forgot to change the Wifi SSID and password (!!!). Once changed, the bidirectional communication with Ubidots works as a charm, even being behind a Cgnat router. Important conclusion: IOT apps running on a 4G/5G router can connect to Ubidots without further issues.