DHCP server and dump got DNS host configuration
I would like to check the configuration of the dhcp server, that is, if the client gets the correct DNS server, domain name, etc. I have a working DHCP setup and a computer with a static IP address from which I can send DHCP requests to a DHCP server.
I am looking for a library (or program) to request a lease and dump all information.
So far I've seen:
- dhcping - works, but does not write out the received lease.
- pydhcpd - not developed, alpha (?)
- pydhcplib - no documentation, not sure if it can actually send packets or is it just encapsulation; Dhquery should work based on this library and claims to be kind of what I want, but after fixing the API change to client.SendDhcpPacketTo gets no response.
Is there any existing script or library that can print or get DNS information that the DHCP server sends? Any language is valid (Perl? Java?).
Ultimately I would like to add this to the Nagios validation script.
source to share
I was just looking for dhclient by creating dhcprobe
Using DHCProbe, you can request a lease from a DHCP server and upload the result to verify the configuration.
Example in verbose mode:
$ sudo ./dhcprobe -v -s 172.20.205.1
Got answer from: 172.20.205.1
option 53 DHCP message type 6 (DHCPNAK)
option 54 Server identifier 172.20.205.1
option 1 Subnet mask 255.255.255.0
option 3 Router 172.20.205.1
option 15 Domain name slh.local
option 6 DNS server 172.20.200.250
option 51 IP address leasetime
option 58 T1
option 59 T2
This allows you to check that the domain name, DNS server, etc. are configured correctly. on the DHCP server.
Source and info here: https://github.com/JohannesBuchner/DHCProbe
source to share