check_dhcp


#1

Hello all -
I don’t understand how the check_dhcp plugin works. I’m sure it’s something simple that maybe one of you could help me with.

I’ve tried running the following command from the nagios command line against our DHCP server to show that it’s working. . .

./check_dhcp -s <dhcp_ip> -i eth0 -t 20

I get an error that tells me:
DHCP problem: No DHCPOFFERs were received.

Anyway, here is what the help displays for that plugin:

This plugin tests the availability of DHCP servers on a network.

Usage: check_dhcp -s serverip] -r requestedip] -t timeout] -i interface]
-v] -s, --serverip=IPADDRESS
IP address of DHCP server that we must hear from
-r, --requestedip=IPADDRESS
IP address that should be offered by at least one DHCP server
-t, --timeout=INTEGER
Seconds to wait for DHCPOFFER before timeout occurs
-i, --interface=STRING
Interface to to use for listening (i.e. eth0)
-v, --verbose
Print extra information (command-line use only)
-h, --help
Print detailed help screen
-V, --version
Print version information

So, do I actually have to query the server for an IP to see if the service is working?
What should the command look like for it to check it properly?

Sorry for the noob question, I’m just confused !!! :cry:

Thanks in advance for any help that you can provide.


#2

try just
./check_dhcp
If you wish to test a particular server, or test gettting a particular IP, then use the options.


#3

jakedup -
I tried using the ./check_dhcp command alone and I get an error:

./check_dhcp
DHCP problem: No DHCPOFFERs were received.

I’ve also tried this with the ip of the server as described in the help for that plugin:

root@nagios_host]# ./check_dhcp -s <dhcp_ip>
DHCP problem: No DHCPOFFERs were received.

Any other suggestions are most appreciated.
Thanks!


#4

if you have used ./check_dhcp with no options, then you are not using dhcp on the network you tried this with.


#5

Jakkedup -
Well I’m pretty sure that our DHCP server is up and running. I work for a cable ISP and if our DHCP server wasn’t working, I’m sure our call center would know about it.

I guess I don’t understand what you mean about not using any options. I have to tell the nagios plugin the IP of the DHCP server so that it knows what machine to check.

My brain is mush right now so maybe I’m missing something. ; p

Anyway, maybe you could clarify this for me.


#6

./check_dhcp --help
This plugin tests the availability of DHCP servers on a network.

Usage: check_dhcp -s serverip] -r requestedip] -t timeout] -i interface]
-v] -s, --serverip=IPADDRESS
IP address of DHCP server that we must hear from
-r, --requestedip=IPADDRESS
IP address that should be offered by at least one DHCP server
-t, --timeout=INTEGER
Seconds to wait for DHCPOFFER before timeout occurs
-i, --interface=STRING
Interface to to use for listening (i.e. eth0)
-v, --verbose
Print extra information (command-line use only)
-h, --help
Print detailed help screen
-V, --version
Print version information

./check_dhcp
DHCP problem: No DHCPOFFERs were received.
That is what I get when ran on a network with no dhcp server on it.
./check_dhcp
DHCP ok: Received 1 DHCPOFFER(s), max lease time = 0 sec.
That is what I get when I do have a dhcp server on my subnet.

If I wanted to, from the network that has no dhcp sever, I could tell the check to use a specific IP addy for a server that I do have access to,
with the -s option
So, bottom line is, I don’t have a dhcp server that is serving my subnet, but yet I do have access to a good dhcp server, so I would have to use the -s option. Perhaps that is your case too.


#7

Well that makes sense. However, it’s still not working for me either way. My nagios host is on the same subnet as our DHCP server so it should work without the -s option. It doesn’t. So, I try it with the -s option, still no luck. Here are my commands that don’t work.

nagios]# ./check_dhcp
DHCP problem: No DHCPOFFERs were received.

nagios]# ./check_dhcp -s
DHCP problem: No DHCPOFFERs were received.

scratches head

I must be missing something…


#8

Still looks to me, like you are not on a net with a dhcp server. Remember, just because I’m on the
xx.xx.xx.yy network and the DHCP server is also, they might have your switch closet subnetted, and that all pc in that subnet are not dhcp. So, check with your admin, if you have to.
Or better yet, remove your nagios box’s static IP, and change it to dhcp and reboot. If so, did you get an IP given to you?


#9

Yeah I’ve checked with my admin, he told me that both are on the same subnet and that the plugin should work. However, I didn’t have it allowed through the Nagios firewall when he glanced at it. So, we thought that might fix the problem. Here is the entry that I added to IPtables.

-A RH-Firewall-1-INPUT -p udp --dport 67:68 -s <dhcp_ip> -j ACCEPT

I restart my iptables, still no joy. Anyway, I logged into IRC and was chatting with someone. He asked me to strace it to a file and send him the output. I did that. It looked like just a bunch of gibberish to me and he hasn’t responded yet.

Anyway, what could I gather from the strace output? would it be beneficial for you to have a look at that?

Thanks Jakkedup!!!


#10

nope, but I would simply turn off your firewall completely on your nagios box. After you have the plugin working, turn it back on.


#11

jakkedup:
Ok after troubleshooting the firewall for too long, I just turned it off for a few seconds to test the plugin from the command line to see if it would work. NO JOY !!!

So now I can rule out a firewall issue on the nagios host. I’ve also setup a firewall rule on the DHCP server side to see if the DHCP request was getting through after issuing the ./check_dhcp plugin. I am seeing the requests. However ,I’m just not getting anything back.

So, I guess I’m wondering if and how the ./check_dhcp plugin is different than a normal client requesting a DHCP OFFER packet. If this is somehow different, than maybe the dhcp server is just not responding because it doesn’t like the request it is seeing and just disregarding it. Possible? Otherwise, I really don’t know what else to look at?


#12

Ok just to clarify about what I am seeing get through on the dhcp server side, that would be the packets hitting the firewall. I setup a log option for DHCP packets coming through in iptables. Therefore, I see the packets hit the firewall.

However, when I move up to the application layer, I check the dhcpd log to see if the packets are getting to the application, I do not see them.


#13

Hi,
I’m also having the same issue with the check_dhcp plugin.
I do know for a fact that my dhcp server is listening - in this case it is the same server as Nagios is running on.
It looks to me like the “No DHCPOFFERs were received” is returned if the DHCP server does not offer any IP’s from a "pool"
I do not have any dhcp pools setup on my server and only have assignments with MAC address.
I have also tried the
check_dhcp --mac=00:16:D4:D5:B4:79
but get the same result…


#14

i have same problem too.
when i run ./check_dhcp -v -i fxp0
i see next messages

./check_dhcp -v -i fxp0
DHCP socket: 3
Hardware address: 00:08:c7:25:98:5b
DHCPDISCOVER to 255.255.255.255 port 67
DHCPDISCOVER XID: 1804289383 (0x6B8B4567)
DHCDISCOVER ciaddr: 0.0.0.0
DHCDISCOVER yiaddr: 0.0.0.0
DHCDISCOVER siaddr: 0.0.0.0
DHCDISCOVER giaddr: 0.0.0.0
send_dhcp_packet result: 548
No (more) data received (nfound: 0)
Result=ERROR
Total responses seen on the wire: 0
Valid responses for this machine: 0
CRITICAL: No DHCPOFFERs were received.

and simultaneously trafshow on interface fxp0 and i see NOTHING!!!
but when i use /etc/netstart with option in /etc/rc.conf ifconfig_fxp0=“DHCP” in trafshow i see broadcast and common negotiations DHCP-client - DHCP-server

whats wrong???


#15

I had the same problem. I had to open UDP ports 67 and 68 on the linux firewall and it worked! :slight_smile:


#16

sealco, you dont understand: on the same PC, same interface i run ./check_dhcp and get error. and run /etc/netstart with option ifconfig_vlan203=“DHCP” and get dhcpoffer

if it was firewall in case with /etc/netstart i must get error too, but i dont

my firewall looks like this

00100 0 0 deny tcp from any to me dst-port 135-139,445 via vlan24
00101 0 0 deny udp from any to me dst-port 135-139,445 via vlan24
00200 57 3752 skipto 205 tcp from xxx.xxx.xxx.xxx/xx to me dst-port 22 in recv vlan24
00201 0 0 deny tcp from any to me dst-port 22 in recv vlan24
65535 39658297 6554222300 allow ip from any to any


#17

Hi!

Same problem here. DHCP server perfectly working and the check_dhcp result is this:

[code]DHCP socket: 3
Hardware address: 00:28:f6:dd:ff:c8
DHCPDISCOVER to 255.255.255.255 port 67
DHCPDISCOVER XID: 873557173 (0x34116CB5)
DHCDISCOVER ciaddr: 0.0.0.0
DHCDISCOVER yiaddr: 0.0.0.0
DHCDISCOVER siaddr: 0.0.0.0
DHCDISCOVER giaddr: 0.0.0.0
send_dhcp_packet result: 548

No (more) data received (nfound: 0)
Result=ERROR
Total responses seen on the wire: 0
Valid responses for this machine: 0
CRITICAL: No DHCPOFFERs were received.[/code]