I'm trying to connect with my NodeMCU through internet using a web app developed by me, what I already achieved was to control it through wifi in the same network using a static IP (which still wasn't very stable), but what I need this time is to be able of controlling it from anywhere in the world, without having to change the public ip in my web app everytime it changes, I found information about NO_IP but I'm not pretty sure of how it works.
4Possible duplicate of How do I avoid port forwarding when exposing IoT devices to the external Internet?– micoSep 11, 2017 at 17:58
1@mico No, not at all. Figuring out what public IP to reach is a different problem from routing the external requests once they have reached the correct IP.– Gilles 'SO- stop being evil'Sep 21, 2017 at 8:57
The actual problem is the same; what differs is just the first idea for a solution; in this case, a rather unwise and insufficient idea, as just knowing the IP address will not be enough without also opening a hole to allow inbound traffic.– Chris StrattonFeb 24, 2018 at 7:48
As already answered in this question, almost every dynamic dns provider uses their own protocol. The protocols are often HTTP-based.
The NodeMCU needs to periodically check its public IP address and send a request like this to update the ip address (for no-ip)
Full specifications: https://www.noip.com/integrate/request
Note: from your question, it seems like you already have port forwarding set up and only need to account for your home IP being changed every now and then. If that's not the case, this answer will be insufficient.
No, the question gives absolutely no indication that port forwarding has been set up or that the poster even realizes that it would be necessary; they have described control within the same network only. Realistically opening their firewall is not a good choice. Feb 24, 2018 at 7:46
I have an idea how to solve your problem. You could periodically check external IP and mail it to yourself when it changes from ESP8266, so you will have a fresh info every time. You can also extend your app which you use to control devices, so it checks the email and when it detects one with a specific subject like "NEW IP ADDR ASSIGNED" it can parse the email and extract the new IP address from the message body. I have done something similar in python and pure Linux shell script.
This is what dynamic DNS services do, only by more efficient channels than email; specifically they send messages to update an actual DNS server. Feb 24, 2018 at 7:47