j13r
j13r

Reputation: 2671

Probe DHCP server and dump received DNS host configuration

I would like to verify a dhcp server configuration, i.e. if a 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 the DHCP server.

I am looking for a library (or program) to request a lease and dump all the information.

So far I have seen:

Is there any existing script or library that can print or receive the DNS information the DHCP server sends out? Any language is acceptable (Perl? Java?).

Ultimately, I would like to put that into a Nagios check script.

Upvotes: 4

Views: 4981

Answers (1)

j13r
j13r

Reputation: 2671

I just forked dhclient, creating dhcprobe

Using DHCProbe, one can request a lease from a DHCP server, and dump the result for verifying 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 verifing that the domain name, DNS server, etc. are configured correctly in the DHCP server.

Source and Info here: https://github.com/JohannesBuchner/DHCProbe

Upvotes: 7

Related Questions