dhcping(8)

πŸ“¦
version 1.2 Β· 2 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– dhcping β€” the vibe check your DHCP server didn't know it needed πŸ’–

okay so bestie, this is dhcping(8) from the General Commands Manual, and it's literally the tool you want when you're like "is my DHCP server even alive rn?" 🫢


✨ NAME ✨

dhcping β€” send a DHCP request to DHCP server to see if it's up and running πŸ”₯


🌸 SYNOPSIS 🌸

dhcping [-v] [-q] [-i] [-r] -t maxwait -c client-IP-address -s server-
IP-address -h client-hardware-address [-g gateway-IP-address]

πŸŽ€ DESCRIPTION πŸŽ€

This command lets the system administrator check if a remote DHCP server is still functioning. like, that's the whole plot. the entire main character arc. πŸ’…

Options are:

  • -v β€” Verbose, print some information. a little yapping, as a treat ✨
  • -V β€” Very verbose, print a lot of information. it's giving full-on narrator mode 😭
  • -i β€” Use DHCPINFORM packets.
  • -r β€” Use DHCPREQUEST packets (default behaviour). this is the default, no cap.
  • -q β€” Quiet, print nothing on the screen. the silent treatment, but make it functional πŸ™ˆ
  • -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 separated 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. πŸ’€ (yes bestie, it's broken, don't come for me, I'm just the messenger)

⭐ RETURN VALUES ⭐

If everything goes okay, it returns 0. If there went something wrong, it returns 1. simple as that. binary. iconic. ✨


🌈 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. it's giving forensic scientist energy πŸ”


πŸ’œ 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. polite queen behaviour, always cleans up after herself 🧚


πŸ‘‘ 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. so it's powerful for like two seconds and then it hands back the crown. respect. πŸ’…


πŸ’€ BUGS πŸ’€

Currently (this may, or may not, change in the future) the ISC DHCP daemon does not write leases with a fixed IP address in the dhcpd.leases file.

DHCPINFORM packets can only be used on subnets the server is authoritative for. If the monitoring script runs on a subnet the server isn't authoritative for, it should use the DHCPREQUEST packets. I also experienced some problems with ISC DHCPD v2 servers, but that is also in the README of it. 😭

The -V option is still working, but shouldn't be used for debugging of the packets. Better use dhcpdump(8) for that, which is available on my website. I wanted to remove it, but decided only to do it from the documentation, not from the code. Maybe I'll need it one day for debugging. (not me keeping dead code around just in case, that's so real of him fr fr πŸ™ˆ)


πŸ¦‹ AUTHOR πŸ¦‹

Edwin Groothuis, edwin@mavetju.org (http://www.mavetju.org) 🫢


🌸 SEE ALSO 🌸

dhcpd(8), dhclient(8), dhcpd.conf(5), dhcpdump(8) ✨


and that's the whole page bestie!! this was the 3rd Berkeley Distribution edition, dated January 27, 2002 β€” yes it's an elder but it still slays πŸ’– go ping a DHCP server, you got this 🌈⭐

πŸ“¦ where this page comes from