Is is possible same local ip in same local network? Esp8266 Static IP Problem

Hello guys,

I'm using Nocemcu. Assigning a static IP address to the device.

My static ip configruration

192.168.1.12 <-- IP
255.255.255.0 <-- Mask
192.168.1.1 <-- Gateway

Everything is okey, my esp8266 is reserving the static ip. But there is a device with same ip in my network. My PHONE! :slight_smile:


How is it possible ? Doesn't the ESP device have to throw an error? :frowning:

How would the esp know that it's already been assigned given that you have set a static IP on it?

Goto your router and set some reserved addresses - I've told my router to not use 192.168.0.1 (the router) to 192.168.0.10 and if I want a static IP I assign one in this range.

Alternatively have an IP dynamically assigned, from my limited experience with the esp8266 (about a week), the default way of doing it. If this is then a problem cos you don't know the IP address use mDNS services to set a name like esp8266.local to talk to it.

AndyMH:
How would the esp know that it's already been assigned given that you have set a static IP on it?

Goto your router and set some reserved addresses - I've told my router to not use 192.168.0.1 (the router) to 192.168.0.10 and if I want a static IP I assign one in this range.

Alternatively have an IP dynamically assigned, from my limited experience with the esp8266 (about a week), the default way of doing it. If this is then a problem cos you don't know the IP address use mDNS services to set a name like esp8266.local to talk to it.

Q:How would the esp know that it's already been assigned given that you have set a static IP on it?
A: I dont know. Maybe gives "IP CONFLICT" error. :slight_smile:

Q:Goto your router and set some reserved addresses - I've told my router to not use 192.168.0.1 (the router) to 192.168.0.10 and if I want a static IP I assign one in this range.
A: I dont want to say to customer "Setup your modem, give me ip range".

Q:Alternatively have an IP dynamically assigned, from my limited experience with the esp8266 (about a week), the default way of doing it. If this is then a problem cos you don't know the IP address use mDNS services to set a name like esp8266.local to talk to it.
A: I saw mDNS. Can i use the multiple esp8266 in same network with MDNS?

Didn't realise there was a customer involved :slight_smile:

If you go for a static IP go for a high one, e.g. 192.168.0.200 - much less chance of the router assigning an IP this high.

yes you should be able to have multiple 8266's on the network, just give each one a different name. As a newbie, found mDNS very easy to set up:

library

#include <ESP8266mDNS.h>

global constant

const String intname = "esp8266e"; //internet access will be http://esp8266e.local

in setup()

if (!MDNS.begin(intname.c_str())) {
    //note use of c_str() to get type right using a string to hold intname
    while (1) { }
      //This is an infinite loop which will run till a break statement is issued 
      //explicitly. Interestingly not while(1) but any integer which is non-zero 

 MDNS.addService("http", "tcp", 80); //setup a listening port

Somewhere in loop()

MDNS.update();

I've got mine setup with a dynamic IP address, but mDNS so it is easy to get to.

AndyMH:
Didn't realise there was a customer involved :slight_smile:

If you go for a static IP go for a high one, e.g. 192.168.0.200 - much less chance of the router assigning an IP this high.

yes you should be able to have multiple 8266's on the network, just give each one a different name. As a newbie, found mDNS very easy to set up:

library

#include <ESP8266mDNS.h>

global constant

const String intname = "esp8266e"; //internet access will be http://esp8266e.local

in setup()

if (!MDNS.begin(intname.c_str())) {

//note use of c_str() to get type right using a string to hold intname
    while (1) { }
      //This is an infinite loop which will run till a break statement is issued
      //explicitly. Interestingly not while(1) but any integer which is non-zero

MDNS.addService("http", "tcp", 80); //setup a listening port




Somewhere in loop()


MDNS.update();




I've got mine setup with a dynamic IP address, but mDNS so it is easy to get to.

My tablet application is android. But MDNS not support for android :frowning: