Connect to an ESP8266 hosted web server from outside the network

Hi all,

I have been working on a project which basically allows me to connect the esp8266 module to my home wifi and from there I can interact with it through a webpage,

I don't know a whole lot about networks, so:

How do I connect to the web server from outside my home wifi?

This is what I'm thinking: (typed into searchbar)
public ip : local ip

Sorry if this question is very broad, or put badly.

Thanks in advance.

I think the typical setup to access an ESP board from the outside world is to connect the esp to your network router as a web server. Then in your router setup you will need to port forward incoming request to the local network IP address of the esp. A dynamic IP address service is typically used to give your network an internet address.

On my router, I am able to limit the IP addresses it gives out via DCHP.
After doing that, I am thinking the OP would give the ESP8266 module a static IP address that is outside that range but within the range of the router.

Example, router's IP is
set IP range from to
Set ESP8266 to


How do I connect to the web server from outside my home wifi?

You shouldn't do that. With most home routers you have the option to forward some ports to some internal devices (read the routers manual for this) but that breaks the security and is not a final solution as most home users don't have a fixed IP address but this is changing from time to time (dynamic IP). There are solutions for this (dynamic DNS) but you should definitely use a more secure solution. One may be a VPN, another may be that you don't connect to the ESP directly but both you and the ESP connect to some external internet service.