ESP8266 NodeMCU Static/Fixed IP Address (Arduino IDE)
This tutorial shows how to set a static/fixed IP address for your ESP8266 NodeMCU board. If you’re running a web server or Wi-Fi client with your ESP8266 and every time you restart your board, it has a new IP address, you can follow this tutorial to assign a static/fixed IP address.


Static/Fixed IP Address Sketch
To show you how to fix your ESP8266 IP address, we’ll use the ESP8266 Web Sever code as an example. By the end of our explanation you should be able to fix your IP address regardless of the web server or Wi-Fi project you’re building.
Copy the code below to your Arduino IDE, but don’t upload it yet. You need to make some changes to make it work for you.
Note : if you upload the next sketch to your ESP8266 board, it should automatically assign the fixed IP address 192.168.1.184 .
View raw code
Setting Your Network Credentials
You need to modify the following lines with your network credentials: SSID and password.
Setting ESP8266 Static IP Address
Then, outside the setup() and loop() functions, you define the following variables with your own static IP address and corresponding gateway IP address.
By default, the next code assigns the IP address 192.168.1.184 that works in the gateway 192.168.1.1 .
Important : you need to use an available IP address in your local network and the corresponding gateway.
In the setup() you need to call the WiFi.config() method to assign the configurations to your ESP8266.
Note: the primaryDNS and secondaryDNS parameters are optional and you can remove them.
After uploading the code to your board, open the Arduino IDE Serial Monitor at the baud rate 115200, restart your ESP8266 board and the IP address defined earlier should be assigned to your board.

As you can see, it prints the IP address 192.168.1.184 .
You can take this example and add it to all your Wi-Fi sketches to assign a fixed IP address to your ESP8266.
Assigning IP Address with MAC Address
If you’ve tried to assign a fixed IP address to the ESP8266 using the previous example and it doesn’t work, we recommend assigning an IP address directly in your router settings through the ESP8266 MAC Address .
Upload the following code to the ESP8266 board:
In the setup() , it prints the ESP8266 MAC Address in the Serial Monitor:

In our case, the ESP8266 MAC Address is B4:E6:2D:97:EE:F1 . Copy the MAC Address, because you’ll need it in just a moment.
Router Settings
If you login into your router admin page, there should be a page/menu where you can assign an IP address to a network device. Each router has different menus and configurations. So, we can’t provide instructions on how do to it for all the available routers.
We recommend Googling “ assign IP address to MAC address ” followed by your router name. You should find some instructions that show how to assign the IP to a MAC address for your specific router.
In summary, if you go to your router configurations menu, you should be able to assign your desired IP address to your ESP8266 MAC address (for example B4:E6:2D:97:EE:F1).
Wrapping Up
After following this tutorial you should be able to assign a fixed/static IP address to your ESP8266. If you have an ESP32, you can read this guide Set ESP32 Static/Fixed IP Address .
We hope you’ve found this tutorial useful. If you like ESP8266, you may also like:
- Home Automation Using ESP8266
- MicroPython Programming with ESP32 and ESP8266
- More ESP8266 NodeMCU Projects and Tutorials …
Thanks for reading.

[eBook] Build Web Servers with ESP32 and ESP8266 (2nd Edition)
Build Web Server projects with the ESP32 and ESP8266 boards to control outputs and monitor sensors remotely. Learn HTML, CSS, JavaScript and client-server communication protocols DOWNLOAD »
Recommended Resources

Build a Home Automation System from Scratch » With Raspberry Pi, ESP8266, Arduino, and Node-RED.

Home Automation using ESP8266 eBook and video course » Build IoT and home automation projects.

Arduino Step-by-Step Projects » Build 25 Arduino projects with our course, even with no prior experience!
What to Read Next…

Programming ESP32 with Atom Text Editor and PlatformIO IDE

[SOLVED] Fix Arduino IDE ESP32 and ESP8266 Board Installation – Error Downloading URLs on Windows PC

MicroPython: BME680 with ESP32 and ESP8266 (Temperature, Humidity, Pressure, Gas)
Enjoyed this project stay updated by subscribing our newsletter, 27 thoughts on “esp8266 nodemcu static/fixed ip address (arduino ide)”.
Thanks for the code Sara. Good like always.
Thanks a lot.
You make my Day. 🙂 Hands in the air for you Regards / Peter (Sweden)
You’re welcome! I’m glad it was helpful
Thank you very much for such excellent tutorials, I would like to know how you can configure the ESP parameters (ssid, pass and fixed ip) from a page or application
Yes, you can definitely do it. I only have this tutorial on that subject: https://randomnerdtutorials.com/wifimanager-with-esp8266-autoconnect-custom-parameter-and-manage-your-ssid-and-password/
Thanks, very much.
hello how to get gateway address and set the ip address according to it. i mean if gateway is 192.168.0.1 then local ip should be 192.168.0.2 and if gateway is 192.168.1.1 then local ip should be 192.168.1.2,plz help
Thanks a lot for your tutorials, they are always a great help for me. This time I’ve a problem and maybe you know how to fix it. I loaded in my NodeMCU your code and, if my router is turned on, it works perfectly. What is strange is that, if my router is turned off, the board send to the serial monitor the same message as il was connected to the router, and this is obviosly impossible. Any idea will be apreciate… Thanks again.
your tutorials are just awesome, informative, and well documented.thank you so much for sharing the knowledge. I wish you the best of luck in all that you do.
Thank you 🙂
Thank you for your useful tutorials!
However, I had a problem with this one: whenever I used a static IP configuration, connection would fail. The ESP8266 would get an IP address but fail to connect to a host. The problem was the ‘subnet’ parameter, which – on my setup – should be the local subnet address , not the netmask. For example, if all of your hosts are on 192.168.1.x then ‘subnet’ should be 192.168.1.0. It all worked fine after I changed that tiny thing. I reckon that most people use dynamic IP addresses, or someone would surely have spotted this.
Thanks, I’ll try it.
First, it not worked when I have written “WiFi.config” below “while (WiFi.status() != WL_CONNECTED)”, after assuming that the MCU executes instructions from up to down, the funny thing is that I heard that compiler verifies program from last to first line, so I used to think the same fom execution, whatever, then I shifed “WiFi.config” above and it worked but… this time It was not accessible I don’t know why, I think there are some protocols for IP, gateway, subnet, DNS etc., I had chnaged IP from 192.168.78.92 to 192.168.1.92 and it worked but I wanted to set it 78.92, but its okay, I know its possible, say me if you get time, thank you very much.
A bit of warning about using static IP without DNS servers. I found that ezTime NTP library do not work if there is no DNS provided, probably do not lookup for ntp servers, so keep it in mind while setting static IP
I wonder if the new routers have become more critical with connection of new devices. This static IP helps with my new router, but then I cannot get connection to Gmail SMTP server.
I switched off the 802.11ax / WiFi 6 mode in my router setup. Now I don’t need static IP and get connection to SMTP server.
Hi there guys, the code is uploading to my board correctly but it’s just not showing me the IP address like it fails to connect to the Wi-Fi, it was worked once before so I know it is possible but no matter how many tries it’s not working again. -Yes I’ve checked the baud rate for the serial monitor -Yes my password and SSID is correct
I need to get this to work for a school project. Your tutorials have been very helpful so far and I’m quite annoyed that I didn’t find it sooner!!
Hi. If you are absolutely sure that credentials are ok, check that the board is relatively close to the Wi-Fi router. Reset the board a couple of times after it fails to connect to Wi-Fi. Regards, Sara
Hiii, im using a websocket server on nodemcu connecting to a website. When im running the client code on the same computer connected to same wifi it works but when it’s connected to a different wifi im getting and error and I’m not able to connect to the server that is on nodemcu. Do you have any solution for it?
Hi. What you do mean? Are you trying to connect to the ESP32 using a different network? If the devices are not on the same network, it will not work. Regards, Sara
Hi,I’m 14 from Taiwan,Thank you so much for your tutorial ,could you tell me if this will also work in AP mode?Thanks!
uploade-connected to wifi too but when load the local adress unable to connect and program html page never loaded
Hi, I want to add this to another tutorial of yours namely: ESP8266 NodeMCU Relay Module – Control AC Appliances (Web Server) However, I receive many errors, guessing it is code clashing. I need to control appliances from my website but the IPs keeps changing
Hi. What errors do you get? Regards, Sara
I figured it out. I replaced the network code from the web server tutorial with this one and placed the IP assign code within the void setup(). Thanks for this tutorials
Leave a Comment Cancel reply
Notify me of follow-up comments by email.
Notify me of new posts by email.
Download Our Free eBooks and Resources
Get instant access to our FREE eBooks, Resources, and Exclusive Electronics Projects by entering your email address below.

ESP8266 static IP address
by jeka | Mar 28, 2022 | Articles | 0 comments

How to set a static IP address for the ESP8266 controller?
We will consider this issue using the NodeMcu 0.9 ESP-12 WIFI ESP8266 controller board as an example.
Studying the standard examples of sketches that are attached to the ESP8266WiFi libraries when setting up the Arduino IDE ESP8266 to work with a WiFi controller, everyone stops at the question: “how can I find out the IP address, which in all examples is obtained dynamically, without using a port monitor?”
The maximum convenience for discovering our controller that is offered in the examples is the suggestion to use mDNS technology. This is a kind of local way of assigning their symbolic names to devices on the network for access to them via the http protocol on tcp.
The first way is mDNS technology
Let’s first consider this way of conveniently accessing our WiFi controller using fictitious symbolic addresses. Moreover, the examples show incomplete and incorrect syntax for calling the mDNS class.
Indeed, the idea is very interesting. It works like this: in the program code of our program, we indicate the symbolic name of the server that will spin in the ESP8266. For example, we will call it greenhouse1. And to access the web page of this server, we simply write in the address bar of the browser of our computer or gadget
and the browser will display the content received from the controller, regardless of the dynamically obtained IP address at the moment.
Here is the modified web server code taken from the standard library example that supports mDNS network naming.
In general, only 4 lines of access to the MDNS class are added to the normal server code. The fact that the library does not take up a lot of controller memory when it is connected can also be attributed to the positive. Now, in order to contact the server, we do not need to know its IP. Just enter http://esp8266.local/ into the browser line and get access to the controller web page and get the answer “hello from esp8266!”. Beauty and splendor isn’t it!? But now back to reality. MDNS technology is currently supported by default only by gadgets with Apple operating systems. On gadgets of other operating systems, it is necessary to install special utilities, with android, in general, the most deplorable thing. It doesn’t suit me at all, to be honest.
I want a static IP on ESP8266
Since the previous method is not suitable for use on various gadgets, let’s unearth the hidden functions of the ESP8266WiFi library. I present to you the function, wired into the standard library, to assign the parameters of the controller’s network connection. Its syntax looks like this.
This function accepts the following parameters: IP address, gateway, and subnet mask. They have a rather interesting variable type (let’s see in an example). config is activated after the begin function.
I’ve taken the previous mDNS example and converted it to a given IP address without the mDNS class.
After downloading this program to the controller board, you can use any browser on the WiFi network to go to the address
and get the answer hello from esp8266!
That is, we get a controller strictly tied to a tangible IP address. This gives us the leverage to organize more complex smart home network configurations. You can work on organizing client-server exchanges of useful information between controllers.
Well, let’s continue to unearth the hidden features of our native WiFi library and display the results of the excavation in articles!
Submit a Comment Cancel reply
Your email address will not be published. Required fields are marked *
Save my name, email, and website in this browser for the next time I comment.
Recent Posts
- Arduino UART circle & PWM LEDs
- Arduino looped UART & flashing LEDs
- NRF24L01 + ATTINY85 connection tutorial
- NRF24l01 + ESP8266 + Arduino NANO connection tutorial
- Arduino big menu example with port monitor
Recent Comments
Setting a static IP on an ESP8266
I am trying to set a static IP address on an ESP8266. According to the example I found at
https://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/station-class.html#start-here
I should be able to do with with WiFi.config(ip) where ip is the static ip address. When I try and call WiFi.config I get
:\Users\ka5co\Documents\Arduino\scannetworkexample\scannetworkexample.ino: In function 'void setup()': scannetworkexample:47:21: error: no matching function for call to 'ESP8266WiFiClass::config(IPAddress&)' WiFi.config(ip);
password is set earlier in the code. I am including ESP8266WiFi.h and no others just as in the example.
The section of my code, in setup(), where I am trying to do this is:
Are there multiple versions of ESP8266WiFi.h or do I have a wrong syntax?
The example uses three parameters you provide only one.
WiFi.config(staticIP, gateway, subnet);
If that does not solve your problem can you post a complete test sketch that shows the issue? Often the issue is in the part not shown.
Did not post the complete sketch because the error is the function is not found. I went digging into the ESP8266.h lib I have and did not find it so was thinking there is an other/newer version. Here is the complete sketch. Thanks

For static ip address I'd rather use the modem router for set it !!! am I wrong? is it no possible?
First I apologies for the multiple responses. Here is a shorter test sketch that demonstrates the problem. Actually two problems. The first is I am having problems setting the ssid within an if-else statement. I can set it but it does not pass out of the if-else statement. probably doing something simple wrong but can't see it. The second is trying to call WiFi.config. That is where I get the function not found error. Thanks again.
I added the following lines to your second/shorter test sketch and the code compiles without any other issues.
The ESP8266.h header file is the right one. It includes a couple of other header files. The one your are looking for is ESP8266WiFiSTA.h. There you can find:
Worked. Thanks.
One of the things I love about Arduino is there is such a wide array of devices to choose from based on your need. One of the frustrating things, for me, is that each one can have a slightly different set of commends or format for the same command. I am old school trained where there is a "book" of commands with all the inputs/outputs defined. But I will adapt and overcome.
Again thanks.
The reason you are having problems setting the ssid within an if-else statement is that you have more than one variable called ssid. If you havea global variable ssdi and then declare another varaible ssid within the scope of the if only the one in the if will be set and that is discarded as soon as you exit the if statement.
Circuits4you.com
Arduino interfacing, circuits tutorials with code and ebooks, step by step guides for all sensor modules used for arduino. programming tips and tricks., esp8266 static ip address arduino example.
In this tutorial we will learn how to use static IP address for ESP8266 NodeMCU . We make LED on off control with simple web server with static IP to our ESP.
Step 1: Required Header files
There is no need of any special header file for having static IP address.
Step 2: WiFi IP configuration variables
IPAddress variable is used in arduino IDE to define IP address . Note it uses comma separated four byte. and NO equal to sign.
Define Device IP address, Gateway (i.e. wifi router ip), subnet mask and dns
You can get this information from your laptops wifi connection details.

Step 3: Connecting to WiFi Router with Above Configuration
Static ip configuration can be applied to ESP using WiFi.config statement.
WiFi.config(staticIP, subnet, gateway, DNS)
Use this command before WiFi begin. WiFi.hostname is optional, it is used to give name to ESP to identify in WiFi router.
Note That: Sequence of WiFi.config is important, first IPaddress, then subnet then gateway and last is DNS
Complete Code of ESP8266 using Static IP address
This code makes a NodeMCU as webserver and controls onboard LED using web interface.
Change the IP settings, SSID and Password as per your WiFi router and upload.
Upload this code and observer serial monitor.
Read more how to get MAC address and List of WiFi Hotspots
- Google Plus
2 thoughts on “ ESP8266 Static IP Address arduino Example ”
Made the sketch like you suggested, but the esp8266 still comes with an ip-adress, that is not in my range. (192.168.4.2 instead of 192.168.178.xx ) as I programmed it to do. Any suggestion?
In line 88, try using
WiFi.config(staticIP, gateway, subnet, dns);
instead of WiFi.config(staticIP, subnet, gateway, dns);
Also, make sure your gateway address is correct. Mine was wrong and the ESP8266 was getting the previous address.
In my case,
Leave a Reply Cancel reply
You must be logged in to post a comment.
ESP8266 Community Forum
Explore... Chat... Share...

- Board index
- ESP8266 Forum
- General Discussions
Arduino IDE and static IP
- Page 1 of 2


Arduino IDE and static IP #20057
User mini profile.
- Joined: Wed Jun 10, 2015 9:51 am
- Status: Off-line
Re: Arduino IDE and static IP #21364
- Joined: Thu Apr 30, 2015 2:34 am

Re: Arduino IDE and static IP #21388
Martinayotte.
- Posts: 3455
- Joined: Sat Sep 06, 2014 11:59 am

Re: Arduino IDE and static IP #21391
- Joined: Mon Jan 05, 2015 3:03 pm
Recent topics from the forum

Have your sensors sending an alarm to Telegram
I used to use IFTTT for sending alarms to my phone[…]
Smart Config
Your setup code is always calling beginSmartConfig[…]
ESP8266-01 showing garbage in serial monitor
im also facing that problem. funny used to work...[…]
ESP8266: Highway Traffic Jams Monitor
the second part is released
Solar Powered ESP12F/Capacitive Soil Moisutre Sensor
You're going to need some sort of storage other th[…]
Applemidi (RTP) library, read midi
Hello, i want to write a firmware for an ESP8266[…]
ESP8266-01 power up
@rooppoorali says:- I do not see this design fit[…]
Esp8266 Ethernet2 Websocket Server
I'm not an expert but figured I would ask some exp[…]
Ahoy DTU VPN possible?
Hi there :) I am a newbie (as you can tell by th[…]

MPU6050 used creating variables for WLED
Good Mornnig, Created a sketch that creates varia[…]
EEPROM put and get methods
Hello, I have tried several codes with all possibl[…]

Talking clock that self-discharges audio for blind people
A small update: In order to use as few mules as p[…]
Problem driving transistors from ESP-01
npn transistors ? try pnp ...
Register documentation
That would help a bit, but it still lacks lots of […]
Using mDNS library <ESP8266mDNS>
I think this is Arduino specific, I'll move it the[…]
Read only GPIO state webserver
You may not find a full tutorial of what you want […]

Esp8266 sms twilio example not compiling
It looks more like your Arduino IDE installation i[…]
PROTECT CODE ON THE ESP8266 ?
Hello Guys, Use the built-in security features of […]
Efficiency Comparison of IDEs&compilers: which is the best?
The thing is, all these environments you've mentio[…]
Linker error Linking CXX Executable
Hello, I have started to explore ESP2886 and ran […]
Follow US on Twitter and get ESP8266 news and updates first.
We are a strong Community of developers, hackers, and visionaries. No, seriously, we are!
Follow on Twitter @ESP8266COM
Stack Exchange Network
Stack Exchange network consists of 181 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. It only takes a minute to sign up.
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
How do I know the IP address assigned to an ESP8266?
I have programmed an ESP8266 using the circuit and program below. I tried to open the SerialMonitor once the program is uploaded to the ESP8266. I am getting an error when I am trying to open the SerialMonitor.
Error opening serial port 'COM5'. (Incorrect serial port)
What is the way to get the IP address assigned to the ESP8266?

- arduino-uno
- 1 you can't run the wifi off the 3.3v of most ftdi adapters; when it's idle in the "ready to flash" mode, it uses less power and works just fine. power the ESP from an external source and your serial port should work again. – dandavis May 8, 2017 at 19:19
- if you have GPIO permanently wired to GND, as your diagram implies, then your "sketch" will never be executed on the ESP – Jaromanda X May 8, 2017 at 23:35
- @dandavis do you mean that should I plug VCC and CH_PD of ESP8266 to other power source instead of FTDI ? I have 2XAA cell holder s3-ap-southeast-1.amazonaws.com/a2.datacaciques.com/wm/… and what voltage cell should I use here ? – N Sharma May 9, 2017 at 4:34
- @JaromandaX Alright, I will remove it so should we only GND to GND other than no wire to GND in any circuit ? – N Sharma May 9, 2017 at 4:35
- you are supposed to give the 01 3.3v. Two fresh AAs will probably be enough to get it working, but won't last the full battery charge. This is why ESP8266 devboards are popular. i keep a few of these around, but you can use an [email protected] and feed it the raw 5v to save cash... – dandavis May 9, 2017 at 4:38
2 Answers 2
If you give your board a name with
(for example) you can then look on your router in the section that lists DHCP assignments (on my Netgear it's Attached Devices ). That should then show you the IP address of all the attached devices, including the ESP8266 which you will easily identify by its name.
Another option is to use mDNS. Look at some of the examples that come with the ESP8266 core and libraries to see how.
I used the app "Fing" on my phone. It shows you the devices that are connected to your WiFi. After entering all freacking IP adress aviable, found that the last one was the one of my esp8266 and a beautiful window saying "hello from esp8266!" appeared.
- I like that app :-) Small thing is that it doesn't work when you put your esp in deep sleep like I did ;-) – Amfasis Dec 24, 2018 at 14:41
Your Answer
Sign up or log in, post as a guest.
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service , privacy policy and cookie policy
Not the answer you're looking for? Browse other questions tagged arduino-uno esp8266 uart or ask your own question .
- The Overflow Blog
- How Intuit democratizes AI development across teams through reusability sponsored post
- The nature of simulating nature: A Q&A with IBM Quantum researcher Dr. Jamie...
- Featured on Meta
- We've added a "Necessary cookies only" option to the cookie consent popup
Hot Network Questions
- A-Z related to countries
- How to prove that the supernatural or paranormal doesn't exist?
- Why are Suriname, Belize, and Guinea-Bissau classified as "Small Island Developing States"?
- How can I explain to my manager that a project he wishes to undertake cannot be performed by the team?
- Chord III is rarely used, but Pachelbel's Canon in D has F#m
- Coasting Along the Coast
- Can I tell police to wait and call a lawyer when served with a search warrant?
- Why does Jesus turn to the Father to forgive in Luke 23:34?
- How does fire heat air?
- Is a PhD visitor considered as a visiting scholar?
- A limit involving the quotient of two sums
- Do new devs get fired if they can't solve a certain bug?
- Bulk update symbol size units from mm to map units in rule-based symbology
- Calculating probabilities from d6 dice pool (Degenesis rules for botches and triggers)
- Equations in two lines
- OK to delete Windows.db file on PC?
- How can I download installation file for GRASS 7.2.0?
- Euler: “A baby on his lap, a cat on his back — that’s how he wrote his immortal works” (origin?)
- Copyright issues when journal is defunct
- Knocking Out Zombies
- Nought and Crosses (tic-tac-toe) in C++
- ncdu: What's going on with this second size column?
- Mathematica not solving this integral
- Theoretically Correct vs Practical Notation
Your privacy
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy .

IMAGES
VIDEO
COMMENTS
Setting ESP8266 Static IP Address Then, outside the setup () and loop () functions, you define the following variables with your own static IP address and corresponding gateway IP address. By default, the next code assigns the IP address 192.168.1.184 that works in the gateway 192.168.1.1.
After downloading this program to the controller board, you can use any browser on the WiFi network to go to the address http://192.168.1.17 and get the answer hello from esp8266! That is, we get a controller strictly tied to a tangible IP address. This gives us the leverage to organize more complex smart home network configurations.
If you want the ESP8266 (or any other network connected device) to always have the same IP address then the best way is leave the device configured to get an IP address using DHCP and assign the desired IP address in the router. Most routers allow you to associate a specific IP address with a particular MAC address.
Mish Mash Labs present how to set a static of fixed IP address for your Espressif ESP8266, ESP32 or Arduino Board. If you’re running a web server or client o...
I am trying to set a static IP address on an ESP8266. According to the example I found at https://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/station-class.html#start-here I should be able to do with with WiFi.config (ip) where ip is the static ip address. When I try and call WiFi.config I get
I want to make my ESP8266 get a static IP address based on the gateway's IP address. I mean if the gateway is at 192.168.0.1 then the ESP8266 should get 192.168.0.15 as a static IP address. And if the gateway is at 192.168.1.1 then it should get 192.168.1.15 as an IP address. esp8266 tcpip Share Improve this question Follow
Step 1: Required Header files There is no need of any special header file for having static IP address. #include <ESP8266WiFi.h> #include <WiFiClient.h> //ESP Web Server Library to host a web page #include <ESP8266WebServer.h> Step 2: WiFi IP configuration variables IPAddress variable is used in arduino IDE to define IP address.
Code: Select all void ESP8266WiFiClass::config (IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns) { struct ip_info info; info.ip.addr = static_cast<uint32_t> (local_ip); info.gw.addr = static_cast<uint32_t> (gateway); info.netmask.addr = static_cast<uint32_t> (subnet); wifi_station_dhcpc_stop ();
4. If you give your board a name with. WiFi.hostname ("MyESP8266"); (for example) you can then look on your router in the section that lists DHCP assignments (on my Netgear it's Attached Devices ). That should then show you the IP address of all the attached devices, including the ESP8266 which you will easily identify by its name.