ESPmDNS: An ESP32 secret (to me anyway)

This entry is part 3 of 5 in the series ESP32
Hey. This page is more than 3 years old! The content here is probably outdated, so bear that in mind. If this post is part of a series, there may be a more recent post that supersedes this one.

ESPmDNS enables (Zeroconf/ Bonjour/) Multicast DNS on your ESP32 (and maybe ESP8266? don’t know) microcontroller.

Previously I’d been assigning a static address to ESP32 devices via my router. This is a pain: you forget what you assigned where-and-when etc.

With a few lines of code, you can access the microcontroller on a local network via http://<unique device name>.local regardless of what IP address is assigned on your local network.

ESPmDNS is an espressif library: here

Add the bit in bold below (and add lib to project in whatever IDE you are using). Bits either side are pretty much boilerplate code.

#include <Arduino.h>
#include "esp_camera.h"
#include <WiFi.h>
#include <ESPmDNS.h>

void setup() {


  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {
  Serial.println("WiFi connected");

  if (!MDNS.begin("Replace with unique_device_name")) {
      Serial.println("Error setting up MDNS responder!");




That’s it.

Series navigation

<< ESP32 meet Science Journal. Science Journal, meet ESP32Blinker: ESP32 library for LED blinking >>