dhcping8
Send a dhcp request to dhcp server to see if it's up and running
Usage
dhcping [-v]
[-q]
[-i]
[-r]
-t
maxwait
-c
client-IP-address
-s
server-IP-address
-h
client-hardware-address
[-g
gateway-IP-address]
Overview
This command allows the system administrator to check if a remote DHCP server is still functioning.
Options are:
-
-v -
Verbose, print some information.
-
-i -
Use DHCPINFORM packets.
-
-r -
Use DHCPREQUEST packets (default behaviour).
-
-q -
Quiet, print nothing on the screen.
-
-t maxwait -
Maximum time to wait for an answer from the server in seconds. Default is 3 seconds.
-
-c client-IP-address -
Request this IP address. Note that this is also the IP address the answer will be sent to.
-
-s server-IP-address -
Send the DHCP packet to this IP address.
-
-h client-hardware-address -
Use this hardware-address in the DHCP request. It can be up to sixteen octets seperated by colons (i.e. 01:02:03:04)
-
-g gateway-IP-address -
Use this IP address for the gateway IP address in the DHCP packet. This option is currently broken.
Return values
If everything goes okay, it returns 0. If there went something wrong, it returns 1.
Setup
This program should be installed setuid root or ran by root only. See SECURITY for more information.
On your DHCP server, add these lines to the dhcpd.conf:
host <your monitoring host FQDN> {hardware ethernet <your monitor host mac address>;fixed-address <your monitoring host IP address>;}
Then try it:
$ dhcping -c your monitoring host IP address \
-s your DHCP server IP address \
-h your monitor host mac address
It will either respond with "no answer" or "Got answer from: your DHCP server IP address"
The DHCP server logfile will give:
DHCPREQUEST for 192.168.1.1 from 00:20:18:56:29:8f via ed0
DHCPACK on 192.168.1.1 to 00:20:18:56:29:8f via ed0
DHCPRELEASE of 192.168.1.1 from 00:20:18:56:29:8f via ed0 (found)
Running in DHCPINFORM mode with -i:
If you see "DHCPINFORM from 192.168.1.1 via xl0: not authoritative for subnet 192.168.1.0", you should add the authoritative statement to the subnet, See dhcpd.conf(5) for details.
When running in very verbose mode, dhcping tries to dump all data of the send and received DHCP packets. It will first dump the packet in hex-format, then decodes the header and finally the options.
How it works
The client either sends a DHCPREQUEST or DHCPINFORM packet to the server and waits for an answer. Then, if a DHCPREQUEST was send, it will send a DHCPRELEASE back to the server.
Security
This program is installed setuid root as it requires the privileges to bind itself to port 68 (bootpc). Root privileges are dropped as soon as the program has bound itself to that port.
Releases
13 releases since Debian 3.0 (Woody); the text changed 4 times.
-V until Debian 13 (Trixie).