ESP32 creating a static IP address

Some weeks nothing seems to go right, and I appear to be having one this week all I’m trying to do is create a static IP address.
I have tried all sorts of permutations and obviously missing something
I have gone back to basics and tried using one of the examples.
and even this fails to connect I have tried three brand-new boards and there is no difference with any of them

no connection at this point
while (WiFi.status() != WL_CONNECTED) {

Any suggestions

Example of connection using Static IP
by Evandro Luis Copercini
Public domain - 2017

#include <WiFi.h>
const char* ssid = “***";
const char* password = "

const char* host = “”;
const char* url = “/index.html”;

IPAddress local_IP(192, 168, 1, 205);
IPAddress gateway(192, 168, 1, 254);
IPAddress subnet(255, 255, 255, 0);
IPAddress primaryDNS(8, 8, 8, 8); //optional
IPAddress secondaryDNS(8, 8, 4, 4); //optional

void setup()

if (!WiFi.config(local_IP, gateway, subnet, primaryDNS, secondaryDNS)) {
Serial.println(“STA Failed to configure”);

Serial.print("Connecting to ");
WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED) {

Serial.println(“WiFi connected!”);
Serial.print("IP address: ");
Serial.print("ESP Mac Address: ");
Serial.print("Subnet Mask: ");
Serial.print("Gateway IP: ");
Serial.print("DNS: ");

void loop()

Serial.print("connecting to ");

// Use WiFiClient class to create TCP connections
WiFiClient client;
const int httpPort = 80;
if (!client.connect(host, httpPort)) {
Serial.println(“connection failed”);

Serial.print("Requesting URL: ");

// This will send the request to the server
client.print(String(“GET “) + url + " HTTP/1.1\r\n” +
“Host: " + host + “\r\n” +
“Connection: close\r\n\r\n”);
unsigned long timeout = millis();
while (client.available() == 0) {
if (millis() - timeout > 5000) {
Serial.println(”>>> Client Timeout !”);

// Read all the lines of the reply from server and print them to Serial
while (client.available()) {
String line = client.readStringUntil(‘\r’);

Serial.println(“closing connection”);

Hi all
I was hoping for some sort of clue here or an example to follow.
Can somebody tell me if it can be done or not yet?
or is this the wrong place for questions like this?

You should ask this is a form of a minimal example at or the Arduino forum.

meathome, you are right, this is a bug. Since a few days, when using:

WiFi.config(ip, gateway, subnet);
WiFi.begin(ssid, password);

there is no way other than omitting the WiFi.config …
to pass the following while (WiFi.status() != WL_CONNECTED) {…

Getting a fixed IP outside the DHCP range e.g for port forwarding is no longer
possible. Do it with an ESP8266, no Problem!

Thank you for your reply and I’m glad that somebody else at long last acknowledged that there is a problem. If we can get more people to to acknowledge the problem, at some point 1 of the boffins might take a look for us, and hopefully put in the solution.

Today I discovered that this Problem is now fixed again, it works as before.
I cannot find out who fixed it, nevertheless thank you.

I’ve been playing with the 8266 for a while now and have not checked for a month or two. I will have to dig out one of my ESP32 and give it a try.
Thank you for letting me know.

Today, Mai 5, I used WIFI.config(…) with an ESP32 again.
An ESP32 flashed long ago still works fine, the one flashed today with the same software has the same Problem again, unable to get an IP with WIFI.config(…).

Note that there is no problem with an ESP8266!

Hardware, Software or maybe Toyware?