Back to Troubleshooting

ESP32 Static IP Failure

Learn how to properly configure static IP addresses on ESP32 boards to avoid connection issues. Understand common pitfalls like subnet mismatches, IP conflicts, and unsupported security modes, and follow best practices for reliable networking.

Common Causes

  • 🛠️

    Incorrect Static IP Configuration

    Manually assigned static IPs must match the router’s subnet and avoid conflicts. Incorrect gateway, subnet, or DNS values can block network access.

  • ⚠️

    IP Address Conflict with Another Device

    If the static IP assigned to the ESP32 is already in use by another device, it may connect but fail to function properly.

  • 🌐

    Incompatible or Restricted Router Settings

    Some routers restrict IP ranges or expect DHCP reservation instead of manual static assignment, especially with client isolation or MAC filtering enabled.

  • 🔐

    Unsupported Security Modes

    Networks using WEP, WPA Enterprise, or uncommon encryption types may not allow proper static IP configuration or stable connection. ESP32 works best with WPA2-PSK.

Symptoms

ESP32 Connects but Cannot Reach Network

Device shows WL_CONNECTED, but no communication is possible with the router or other devices.

IP Shows 0.0.0.0 or Invalid Range

Serial output shows WiFi.localIP() as 0.0.0.0, or a static IP outside the router’s configured subnet.

ESP32 Not Discoverable Despite Successful Connection

Device connects but cannot be pinged or accessed, due to incorrect gateway/subnet or routing rules.

Solutions

Use Correct Static IP Configuration

Set the IP, gateway, subnet, and DNS carefully to match your network. Use IPs outside the DHCP range to avoid conflicts.

Test First with DHCP, Then Apply Static IP

Confirm that the ESP32 connects and functions using DHCP before applying a static configuration. This helps isolate IP-related issues.

Use WPA2-PSK and Avoid Legacy Security

Ensure your router is using WPA2-Personal (PSK) mode. Avoid WEP and WPA Enterprise, which are not well-supported by ESP32 and can block proper IP setup.

More Details

ESP32 Static IP Failure #

Assigning a static IP address to your ESP32 can be useful for local servers, OTA updates, or consistent device access — but it can also introduce subtle networking issues if not done correctly.

If your ESP32 connects but doesn’t seem to communicate or has an invalid IP, it’s likely a static IP misconfiguration.

Common Symptoms #

  • WiFi.localIP() shows 0.0.0.0 or an IP that doesn’t match your network
  • ESP32 reports WL_CONNECTED but cannot be pinged
  • Device works with DHCP but fails when static IP is used
  • Web server or OTA updates don't function reliably

Why Static IP Can Fail #

🧱 Incorrect Network Parameters #

You need to specify a valid IP, gateway, subnet, and DNS manually. If these don’t match your router’s actual configuration, the ESP32 might connect but won’t work properly.

⚠️ IP Conflict #

If you assign an IP already used by another device, you'll get erratic or broken behavior — even if the ESP32 reports success.

🔒 Security Mode Compatibility #

ESP32 works best with WPA2-Personal (PSK). Routers using WEP, WPA Enterprise, or other unusual modes may cause connectivity issues when paired with static IPs.

🌐 Router or Network Restrictions #

Some networks disallow manual IPs or require DHCP reservation via MAC address. Others restrict device communication when AP isolation is on.

How to Set a Static IP Correctly #

Use WiFi.config() before calling WiFi.begin():

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

WiFi.config(local_IP, gateway, subnet, primaryDNS, secondaryDNS);
WiFi.begin("YourSSID", "YourPassword");

Tips:

  • Make sure the IP is outside your router’s DHCP range
  • Use the correct gateway and subnet for your router
  • Check for IP conflicts using your router’s device list or a network scanner

Test with DHCP First #

Before using a static IP, try:

WiFi.begin("YourSSID", "YourPassword");

Once you confirm the ESP32 connects and functions properly, switch to static IP to isolate issues.

Summary #

Static IPs on ESP32 require careful configuration. Use DHCP to validate credentials and network access first. Then, apply static settings thoughtfully — and avoid legacy security like WEP or WPA Enterprise.

Still Stuck with an ESP32 Issue? Let's solve it together.

Our interactive troubleshooting wizard will guide you through common ESP32 problems and their solutions, step by step.

No registration required. Start solving issues right away!