network.priority on ESP32 can leave global DNS empty after secondary interface DHCP start
The problem
ESPHome 2026.9.0 enables CONFIG_ESP_NETIF_SET_DNS_PER_DEFAULT_NETIF when multiple interfaces are configured through network.priority, and NetworkComponent explicitly selects the preferred interface with esp_netif_set_default_netif().
ESP-IDF v5.5.5 has a confirmed bug in this combination: starting DHCP on a non-default interface can clear the global lwIP MAIN/BACKUP DNS servers. After esp_netif_set_default_netif() has manually pinned the default interface, the ESP-IDF interface-event path may no longer restore those DNS servers.
This is tracked upstream in Espressif as:
espressif/esp-idf#19082
The lower-level issue has a deterministic ESP32-S3 reproduction showing this state:
default interface DNS cache: valid
lwIP default route: valid
global lwIP DNS table: emptyESPHome's current NetworkComponent::loop() appears unable to detect this state. When the same preferred interface is still selected, it verifies only the lwIP default route:
if (best == this->default_netif_) {
...
route_is_ours =
static_cast<void *>(netif_default) == esp_netif_get_netif_impl(best);
if (route_is_ours)
return;
}So if the route is still correct but the global DNS table has been cleared by a later DHCP start on another interface, ESPHome returns without reasserting the default interface or restoring its DNS servers.
The relevant ESPHome 2026.9.0 behavior is:
if len(priority_list) > 1 and CORE.is_esp32:
cg.add_define("USE_NETWORK_DEFAULT_ROUTE")
add_idf_sdkconfig_option(
"CONFIG_ESP_NETIF_SET_DNS_PER_DEFAULT_NETIF", True
)I do not think disabling CONFIG_ESP_NETIF_SET_DNS_PER_DEFAULT_NETIF is the right solution: ESPHome enables it intentionally so that DNS follows the selected default interface.
The open question is whether ESPHome should temporarily detect/recover this inconsistent state while affected ESP-IDF versions are supported, or simply track the ESP-IDF fix and rely on it once available.
Which version of ESPHome has the issue?
2026.9.0
The same relevant NetworkComponent route-check logic is also still present on current dev.
What type of installation are you using?
pip / command line
What platform are you using?
ESP32
Component causing the issue
network
YAML Config
The following is the same basic multi-interface configuration shape used by ESPHome's own network.priority component tests:
esphome:
name: test
esp32:
board: esp32dev
framework:
type: esp-idf
wifi:
ssid: "test_ssid"
password: "test_password"
ethernet:
type: W5500
clk_pin: 19
mosi_pin: 21
miso_pin: 23
cs_pin: 18
interrupt_pin: 36
reset_pin: 22
clock_speed: 10MHz
network:
priority:
- ethernet
- wifiThe problematic sequence is when one interface is already the selected/default interface with valid DHCP DNS, and DHCP is subsequently started on the other interface.
The standalone hardware-independent reproduction of the underlying DNS clearing is available in ESP-IDF issue espressif/esp-idf#19082.
Anything in the logs that might be useful for us?
In the downstream case that led us to investigate this, WiFi remained connected and selected while outbound hostname-based connections started failing:
[I][wifi]: Connected
[I][network]: Default interface: sta
[I][openquatt.network]: Active connection: WiFi
...
[E][http_request]: HTTP Request failed: ESP_ERR_HTTP_CONNECT
[E][http_request.update]: Failed to fetch manifest
[W][openquatt.usage_telemetry]: Usage statistics publish failedImportant: the global DNS table was not measured on that particular controller during the failure, so this log is only a matching symptom and is not being presented as proof that this specific incident was DNS-related.
The DNS state itself is independently reproduced and measured in espressif/esp-idf#19082.
Additional information
Relevant upstream issue:
- espressif/esp-idf#19082 —
Non-default DHCP startup clears active DNS servers; manual default-interface override prevents restoration
Relevant ESPHome 2026.9.0 code:
esphome/components/network/__init__.pyesphome/components/network/network_component.cpp
A downstream workaround was added in OpenQuatt:
- OpenQuatt/OpenQuatt#767
That workaround checks whether global MAIN/BACKUP DNS is empty while the selected default interface still has cached DNS, and restores only the missing entries. It is intended as a bounded workaround, not as a replacement for an upstream ESP-IDF fix.
Would it make sense for ESPHome to either:
- temporarily validate/reassert DNS for the current default interface in
NetworkComponent, or - explicitly track espressif/esp-idf#19082 and remove any mitigation once ESPHome uses an ESP-IDF version containing the upstream fix?
Source: esphome/esphome