How to check if DHCP Server is running in a network

John Hascall john at iastate.edu
Tue May 27 12:43:22 UTC 2008


> > You could use a simple perl script with help from Net::DHCP::Packet.
> 	Or see http://www.mavetju.org/unix/dhcping-man.php

My suggestion is to do something that fits in with whatever
you are using generally for system/service monitoring (and
if you aren't, now might be a good time to start).

We use hoBBit for this, so we have a simple "ext" script
which invokes a small C program which sends and times
the replies (or not) of DHCPINFORMs.

Since we use NetReg our dhcpd restarts quite a bit, so
the program tries to be adaptive in how many / how fast
it sends queries.

Tue May 27 07:20:44 CDT 2008
dhcpd status for host netreg-1.its.iastate.edu
dhcpok: May 27 07:20:44: send ok [0.000057 s]
dhcpok: May 27 07:20:44: read ok [0.000479 s]
dhcpok: May 27 07:20:44: send ok [0.000021 s]
dhcpok: May 27 07:20:44: read ok [0.000608 s]
dhcpok: May 27 07:20:44: send ok [0.000012 s]
dhcpok: May 27 07:20:44: read ok [0.001201 s]
dhcpok: May 27 07:20:44: Status green: 3 sent (0 failed), 3 rcvd, 0 timeouts

If that read time starts climbing up anywhere near a second
then I have an early warning of a problem.  Such as here
when we had a ddns issue (which was in turn slowing down
dhcp) [this example also caught a restart]:

dhcpd status for host netreg-1.its.iastate.edu
dhcpok: Feb 16 00:00:18: send ok [0.000128 s]
dhcpok: Feb 16 00:00:18: select timeout [1.005977 s]
dhcpok: Feb 16 00:00:19: send ok [0.000017 s]
dhcpok: Feb 16 00:00:19: select timeout [1.009943 s]
dhcpok: Feb 16 00:00:21: send ok [0.000018 s]
dhcpok: Feb 16 00:00:21: read ok [0.258452 s]
dhcpok: Feb 16 00:00:21: send ok [0.000007 s]
dhcpok: Feb 16 00:00:21: read ok [0.023952 s]
dhcpok: Feb 16 00:00:21: send ok [0.000008 s]
dhcpok: Feb 16 00:00:21: read ok [0.037845 s]
dhcpok: Feb 16 00:00:21: send ok [0.000007 s]
dhcpok: Feb 16 00:00:21: read ok [0.077197 s]
dhcpok: Feb 16 00:00:21: send ok [0.000008 s]
dhcpok: Feb 16 00:00:21: read ok [0.001009 s]
dhcpok: Feb 16 00:00:21: Status yellow: 7 sent (0 failed), 5 rcvd, 2 timeouts


A copy of the program (no warranty, use at your own risk, ...)
can be found at:
  http://john.public.iastate.edu/public/dhcp/dhcpok.c

John


More information about the dhcp-users mailing list