brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: nmap broadcast-dhcp-discover shows which DHCP server answers

Nmap
~/tips/tip-nmap-broadcast-dhcp-discover

sudo nmap --script broadcast-dhcp-discover

Ask the local network for a DHCP offer and see who replies.

Devices get a strange gateway or DNS server, and you suspect a second router is handing out addresses. This script sends a DHCP request on the local network and reports the offers.

sudo nmap --script broadcast-dhcp-discover

No target is needed. For each reply you see details such as the offered address, the server identifier, subnet mask, router, DNS servers and lease time. The server identifier is the part I’d compare with the address of the box that is supposed to do this job. If it is something else, you have found your extra DHCP server, often a spare router or a mesh unit left in router mode.

By default the script waits 10 seconds. A slow server can be given longer:

sudo nmap --script broadcast-dhcp-discover --script-args broadcast-dhcp-discover.timeout=20

It uses a fixed MAC address on purpose, so repeated runs don’t drain the address pool. Leave it that way.

It needs root, and it only hears servers in the same broadcast domain, so run it from the network segment where the problem happens. If two servers answer, don’t assume you have seen them all after one run. Run it a few times. Use it on your own network only.

Further reading: broadcast-dhcp-discover script

More Nmap tips nmap --packet-trace -p 22,80 192.0.2.10 nmap -p 22,80,443 -oG scan.gnmap 192.0.2.0/24 nmap -sV 192.0.2.10 sudo nmap -sU -p 53,67,123,161 192.0.2.10 nmap -sL 192.0.2.0/28 All Nmap tips (12) All topics

Link