So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By jeffas
#61909 The 192.168.x.x address range is what is called a "non-routable address". It is valid only within a local area network (LAN). At home, you have one, and only one, external IP address, which is visible to anyone on the Internet. You can't use the 192.168.x.x from outside your LAN. Almost everyone in the world who has a LAN will be using 192.168.x.x addresses inside their home. The Internet cannot decide which one you mean when you try to connect to one of those addresses.
From outside, you can connect only to your external address, provided by your Internet Service Provider (ISP).
If you connect from outside to that external address, your router needs to know which of your internal servers is the intended destination. That is where port forwarding comes in. You must tell your router something like this:
"If you receive a connection for port 80, please forward it to 192.168.1.134 port 80."
Then, the connection from outside will go to your ESP.
If you want more details, search the web for "Network Address Translation" or "NAT".
User avatar
By Rachita
#61946 @jeffas, Thanks for you reply, I was wondering the same, I have found this link, is it suitable to do? want a confirmation before I go ahead with this solution.
https://alselectro.wordpress.com/2016/10/05/how-to-make-your-devices-ip-address-static-port-forward-a-practical-demo-part-1/
User avatar
By jeffas
#61951 Yes that looks good. The instructions on how to configure the router are very specific to that model of router. So it will probably look different on yours. But the idea is the same.
If your ESP has already connected to the router once, then the router should know the ESP's MAC address. If your router allows this, associate that MAC address with the IP address. On my router, this is simply a check-box saying "always assign this address". Then you don't have to worry about setting the IP address on the ESP itself; the router will always assign the same address. This is the best way to do it, because it lets you move the ESP to another network without having to change the sketch to suit the new network.
The same applies to your PC. If you are using a laptop that you will also use in other locations, do not give it a static IP address; or remember to change it back to dynamic when you take it away from home.

Having a static external IP address from your ISP is good, but not all ISPs provide this service. An alternative is to use "dynamic DNS". This gives you a hostname for your home network. You set up your router to contact the dynamic DNS server every time it gets a new external address. Then you use the hostname to connect to home. Search for "free dynamic dns" to find a free service provider. Or there are paid-for services.

One more point: You will be making your ESP accessible to everyone on the Internet. You might want to consider adding some sort of password protection.