Short answer

mDNS hostname never appears on the LAN. What blocks it?

  • mDNS needs multicast on the LAN. Some guest Wi-Fi and AP isolation modes drop it.
  • The device must have a valid IP first. mDNS will not invent reachability without Station.
  • Phone OS and Windows discovery differ. Test with a tool that queries _services._dns-sd._udp.local.
  • For production, treat mDNS as a convenience, not the only way to find the unit.

中文

短答

局域网找不到 ESP32 的 mDNS 主机名,卡在哪?

  • mDNS 依赖组播。访客 Wi-Fi、AP 隔离常会丢掉。
  • 设备要先有合法 IP。没有 Station,mDNS 变不出可达性。
  • 手机系统和 Windows 发现方式不同。用能查 _services._dns-sd._udp.local 的工具验证。
  • 量产把 mDNS 当便利手段,不要当唯一寻址方式。