Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm planning a new feature on our product to support a LAN. Since the installation will be done by relatively non-technical people (it's for boats) I was thinking it would be useful to automatically detect whether we needed to provide a DHCP server or not, depending on one was already on the network. Is there an official way of checking whether there's already a DHCP server (or more than one) on the network?

We use Embedded Linux on the product.

share|improve this question
did you find an answer to this? – Tom H May 13 '12 at 2:51
Haven't had a chance to try dhcp_probe on our device yet. – parsley72 May 13 '12 at 19:50
up vote 10 down vote accepted

fedora seems to have the following package in the repos "dhcp_probe"

Description : dhcp_probe attempts to discover DHCP and BootP servers on a directly-attached Ethernet network. A network administrator can use this tool to locate unauthorized DHCP and BootP servers.

Looks like the man dhcp_probe has some good pointers for DHCP discovery strategy that might be worth a look, even if you decided to go for crafting the packets yourself.

No single request packet is likely to provoke a response from every possible BootP and DHCP server. Some servers may only response to either BootP, or DHCP, but not both. Some servers may be configured to only respond to a small set of known clients. Some DHCP servers will only provide leases to a small set of known clients, but may be willing to respond (negatively) to unknown clients that request a lease renewal on an inappropriate IP address. Therefore, dhcp_probe actually sends not one, but five different flavor request packets, in the hopes of provoking responses from a wider variety of unknown servers.

$ rpm -qil dhcp_probe
Name        : dhcp_probe
Version     : 1.3.0
Release     : 8.fc15
Architecture: x86_64
Install Date: Mon 30 Apr 2012 12:20:46 AM BST
Group       : System Environment/Daemons
Size        : 133600
License     : GPLv2+ and MIT
Signature   : RSA/SHA256, Thu 28 Jul 2011 11:45:40 AM BST, Key ID 067f00b6a82ba4b7
Source RPM  : dhcp_probe-1.3.0-8.fc15.src.rpm
Build Date  : Tue 08 Feb 2011 01:58:57 PM GMT
Build Host  :
Relocations : (not relocatable)
Packager    : Fedora Project
Vendor      : Fedora Project
URL         :
Summary     : Tool for discover DHCP and BootP servers
Description :
dhcp_probe attempts to discover DHCP and BootP servers on a directly-attached
Ethernet network. A network administrator can use this tool to locate
unauthorized DHCP and BootP servers.
share|improve this answer
there seems to be a pretty good description of the various strategies for bootp and dhpc server discovery in the man page for dhcp_probe – Tom H Apr 29 '12 at 23:28

Let's not confuse the word "official" with the concept of "generally accepted method".

One generally accepted method would be to issue a DHCPDiscover packet and look for a response.

share|improve this answer
Understood. I just wanted to know if there was a "proper" way of doing it before implementing my own! – parsley72 Apr 29 '12 at 23:20

If you have "dhcpcd" installed, you can use the "-T" flag, to get the "test" mode, which just echoes the settings, but does not actually set the IP address and the gateway.

dhcpcd -T

and the output:

emily ~ # dhcpcd -T wlan0
dhcpcd[6205]: version 5.2.12 starting
dhcpcd[6205]: wlan0: broadcasting for a lease
dhcpcd[6205]: wlan0: offered from
share|improve this answer

You could do your own DHCPDISCOVER to see if anything out there is configured to answer, but if the DHCP server is locked down to specifics MACS you may not get a response.

You could in theory do a UDP port scan for UDP67 and UDP68, but I'm not so sure that's a great idea as it's more likely to get flagged as possibly malicious behavior.

Generally speaking, products that are not network equipment should not be offering DHCP. It makes an actual sysadmin's job harder, especially if it has a tendency to turn on by default if it loses its settings.

That's one thing that always drove me batty about the old crappy Hawking Ethernet to USB "print server" converter boxes.

share|improve this answer

Send a DHCP request and wait to see if you get a DHCP offer.

Cruder method - set up a NIC so it recives an IP address via DHCP then check after a period whether it receives an APIPA address. If it receives an APIPA address it is unlikely there is an existing DHCP server connected to the network in question.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.