× General topics about hardware.

static ip for esp8266?

8 years 11 months ago #1431 by leolopezglez
Hello , I have the problem that every time you restart the ESP8266 modules by power cycling the power supply the IP address changes , and I can set up a static ip each module to never change ?

Please Log in or Create an account to join the conversation.

8 years 11 months ago - 8 years 11 months ago #1436 by ArneiO
Replied by ArneiO on topic static ip for esp8266?
One way to do this is in your Wifi router. I have a D-Link router, and in the setup I go to Setup / Network settings / DHCP reservation. I can then ask the router to give a given MAC address a fixed IP address.

Alternatively, the ESP can request a certain IP address from the router. The command will depend on which firmware you're running.

In NodeMCU/Lua:
SSID = "YOUR SSID"
PW = "YOUR SSID PASSWORD"
IPADR = "192.168.0.126" //Requested static IP address for the ESP
IPROUTER = "192.168.0.1" // IP address for the Wifi router
wifi.setmode(wifi.STATION)
wifi.sta.setip({ip=IPADR,netmask="255.255.255.0",gateway=IPROUTER})
wifi.sta.config(SSID,PW)

Please Log in or Create an account to join the conversation.

8 years 10 months ago #1760 by thesun93pp
Replied by thesun93pp on topic static ip for esp8266?
hi ArneiO!

i'm new bie, i use arduino to connect with ESP8266, config ESP.
so with Arduino's code. What can i do to set static ip for ESP8266.
Thank you

Please Log in or Create an account to join the conversation.

8 years 10 months ago #1769 by EasyIoT
Replied by EasyIoT on topic static ip for esp8266?

thesun93pp wrote: hi ArneiO!

i'm new bie, i use arduino to connect with ESP8266, config ESP.
so with Arduino's code. What can i do to set static ip for ESP8266.
Thank you


you can set static ip for esp in router settings.

Please Log in or Create an account to join the conversation.

8 years 10 months ago #1772 by thesun93pp
Replied by thesun93pp on topic static ip for esp8266?
:) thank you very much! I will try!

Please Log in or Create an account to join the conversation.

8 years 6 months ago #2403 by leaosir
Replied by leaosir on topic static ip for esp8266?
Hi leolopezglez, I hope my answer not too late.

But if you want to put a static ip you have to write this command

AT+CIPSTA="192.168.1.100"
The following user(s) said Thank You: godfish

Please Log in or Create an account to join the conversation.

Time to create page: 0.299 seconds

Forum latest

  • No posts to display.