The ESP8266 as Network Scanner

Several months ago I wanted to retrieve additional information from the existing devices in my LAN with an ESP8266 and display them. On Windows you can scan your network with several tools (AngryIP is just one example), on a RaspberryPi you can try ARP, on an Android Smartphone you can try the app Network Analyzer. You can ping devices on your network with the ESP8266. But I was also interested in Hostinfo/Hostname/NETBIOS info for easier identification of the devices.


On this page I will show some strategies to gather data of your own network with an ESP8266 like:

  • Network Ping to find used IPs
  • mDNS to gather hostnames
  • mDNS SD to gather services

and some alternatives. Finally I will show a complete sketch which can be downloaded at the end of the page.

Network Ping with the ESP8266: ESP8266Ping

There is a ping library from Daniele Colanardi named ESP8266Ping - you can find a download link at the end of the page. You can do a simple ping for all possible IPs and voila - at least you know which devices are on your LAN.


MDNS (Multicast Domain Name Service) resolves hostnames to IP addresses. MDNS can be activated on the ESP by including the ESP8266mDNS.h Library and some lines in setup()

 if (!MDNS.begin("myesp")) {
Serial.println("Error setting up MDNS responder!");
else {
Serial.println("mDNS responder started");

The ESP can now be found with "myesp.local" on the local network.


mDNS SD (SD stands for Service Discovery) can be used to ask network devices for their services. As response you not only get the port of the service but also the device hostname.

For a quick start, follow the IDE example ESP8266mDNS/mDNS-SD_Extended. It can discover several services on your network.

It seems that if you enable Arduino IDE OTA on an ESP, the ESP will register a Service "_arduino." either on Port 8266 (an ESP8266) or 3232 (ESP32).

Browsing service _arduino._tcp.local. ... 3 service(s) found
1: esp48T-Display-S3.local (
2: esp76D1R32Board.local (
3: esp113Wasser.local (

MDNS Register Services

As mentioned Arduino IDE OTA will register the Arduino service. You can also register services yourself. If you have an ESP with a webserver just put this line in your setup():

MDNS.addService("http", "tcp", 80); // Announce service - we have an webserver running

Digression: Searching for Webservers

Once we have an successful ping respone from a device you can try if you can find a webserver on port 80 of that device.


SNMP (Simple Network Management Protocol)  is an internet standard protocol for collecting and organizating information about devices on IP networks. Some LAN/WiFi router offer an API and you might be lucky to be able to read the routers devices list.

Also UPnP and DLNA as subset might be useful to gather information from your netwok.

An Example Sketch: List all Devices In your Own Network with the ESP8266

My Example sketch will do following:

  • On startup it will search for several services. Mainly "_arduino" (most of my ESPs are using OTA), and "_http".
  • During runtime the ESP will try to discover services (MDNS SD) each minute.
  • During runtime the ESP will ping one IP after the other. This will take quite long, as there is the blocking long default timeout of 1 second for the ping and therefore the sketch only scans each 3 seconds. This means a full network scan will take some time (255 x 3 seconds ~  13 minutes).
  • If a ping was sucessful the sketch also tries to open the root/homepage of that device.
  • Show results on a webserver

The scanning ESP provides a webserver itself to represent the gathered data of the network:

Each box represents one device. The IP is in the blue caption. If the device provides a hostname it will be shown in bold. Each registered service will be shown with the port. If the device has a webserver the full box is a link to that device:


An ESP8266 can be used as network scanner

(*) Disclosure: Some of the links above are affiliate links, meaning, at no additional cost to you I will earn a (little) comission if you click through and make a purchase. I only recommend products I own myself and I'm convinced they are useful for other makers.


First upload: 2023-10-31 | Version: 2024-03-22