Accessing more than one ESP8266 thru the web remotely

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
fariz
Posts: 5
Joined: Mon Jun 18, 2018 4:38 pm
Location: Santo Domingo
Contact:

Accessing more than one ESP8266 thru the web remotely

Post by fariz » Thu Jul 05, 2018 9:06 pm

Hi, I am developing a project with several esp8266 modules remotely monitored and configured thru webrepl, I have success connecting remotely to one unit with different domain name but I need to access more than one module in the same domain and in order to do that I need to change the default (:8266) port in weprepl is there a way to do it? or I have to change the strategy.

Here an Example of what I look for:
(domain1.noip.me:8266, domain2.noip.me:8266) let me access the module,
but how I do for the other modules (domain1.noip.me:8267, domain1.noip.me:8268) or whatever port to choose?

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Accessing more than one ESP8266 thru the web remotely

Post by Roberthh » Fri Jul 06, 2018 6:36 am

I do not understand you problem. You have to use different IP addresses anyhow for each ESP8266. In that case, identical port numbers do not hurt.

kevinkk525
Posts: 969
Joined: Sat Feb 03, 2018 7:02 pm

Re: Accessing more than one ESP8266 thru the web remotely

Post by kevinkk525 » Fri Jul 06, 2018 8:25 am

if you connect externally, you have to setup a firewall/proxy from port 8267 to that esp on 8266.
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode

fariz
Posts: 5
Joined: Mon Jun 18, 2018 4:38 pm
Location: Santo Domingo
Contact:

Re: Accessing more than one ESP8266 thru the web remotely

Post by fariz » Fri Jul 06, 2018 5:22 pm

Roberthh wrote:
Fri Jul 06, 2018 6:36 am
I do not understand you problem. You have to use different IP addresses anyhow for each ESP8266. In that case, identical port numbers do not hurt.
Hi Robert, thank you for your quick reply, of course I use different IP addresses but when you use a domain name to access the units, the only way I know is assigning a different port number to each unit since the external IP address assigned by the DNS is unique, so when I have, lets say two IP cameras at home and internally I assign 10.0.0.5 to camera1 and 10.0.0.6 to camera2 I have no problem but when I want to access them from my office or mobile remotely I have to use a DNS service that gives me a unique name, then in my router I assign port number 10.0.0.5:8005 to camera1 and 10.0.0.6:8006 to camera 2 then I access from the web each camera like so:

camera1 at home ----(mydomain.cctv.com:8005)
camera2 at home ----(mydomain.cctv.com:8006)

because mydomain.cctv.com is unique,

in the case of access the ESP8266 units would be like so,

esp1 at home ----(mydomain.cctv.com:8266)
esp2 at home ----(mydomain.cctv.com:8267)

I just can access esp1 thru webrepl (ws://mydomain.cctv.com:8266/)but not esp2 since I can not change the default port 8266.

unless there is another way that I don't know yet.
kevinkk525 wrote:
Fri Jul 06, 2018 8:25 am
if you connect externally, you have to setup a firewall/proxy from port 8267 to that esp on 8266.
Hi Kevin, the solution you give me is to be configured in the router? or where I have to do it? I don't get it, can you give me an example, please.

Thanks

User avatar
deshipu
Posts: 1388
Joined: Thu May 28, 2015 5:54 pm

Re: Accessing more than one ESP8266 thru the web remotely

Post by deshipu » Fri Jul 06, 2018 11:39 pm

You can configure your router to forward ports on the external network to different IP addresses and ports on the internal network.

However, you probably don't want to have your ESP8266s exposed to the Internet as a whole like that. It's only a matter of time until some automated scanner finds it.

kevinkk525
Posts: 969
Joined: Sat Feb 03, 2018 7:02 pm

Re: Accessing more than one ESP8266 thru the web remotely

Post by kevinkk525 » Sat Jul 07, 2018 2:26 pm

Yes that would be the solution i meant.
But as pointed out, this is a very bad solution. I'd rather use a VPN to connect to your home network and access the esp8266 that way.
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode

fariz
Posts: 5
Joined: Mon Jun 18, 2018 4:38 pm
Location: Santo Domingo
Contact:

Re: Accessing more than one ESP8266 thru the web remotely

Post by fariz » Sun Jul 08, 2018 1:25 pm

Thank you all, I was not thinking to tweak the router to solve the problem, and I will explore the VPN strategy.

Post Reply