DHCP Debug tool (OBSOLETE)
- Based on work done by Ethan Galstad (nagios@nagios.org) for the nagiosplugin Original source file CHECK_DHCP.C (see source for full Copyright) Copyright (c) 2001-2004 Ethan Galstad (nagios@nagios.org)
- What? Sends DHCP requests and watches for replies
- Why? Verify DHCP server operation - look for ROGUE DHCP servers!!!
- Features
- can set source MAC address - useful for debugging various clients
- verbose output includes IP address of DHCP servers that reply
- See EXAMPLE below for full listing
- Notes MUST BE ROOT to run this utility
Source Files
- Secondary locations \\asimov.cscf.uwaterloo.ca\exports\linux\dhcp
dhcp.c
Verified 25 Oct 2011 with Ubuntu 10.04 LTS 64bit
- Modified standalone version of check_dhcp.c targeted for linux
- Added option to set mac address in DHCP DISCOVER PACKET
- File: dhcp.c: dhcp.c modified source
- Compile: gcc dhcp.c -o dhcp
dhcp
Binary compiled for linux
check_dhcp.c
check_dhcp.c.diff
- Context diff of both files showing changes I made
- File: check_dhcp.diff: check_dhcp.diff context diff of changes
README.txt
- Summary of files
- File: README.txt: README.txt Summary of files
EXAMPLE.txt
- Note: in this example we could not set our device address - but we did change the MAC address in the packet - The result is still valid
- File: EXAMPLE.txt: EXAMPLE.txt Example Usage
EXAMPLE Usage
- ./dhcp -v -i eth1 -m 00:0b:cd:ad:14:68
- -i set interface to eth1
- -m set MAC to 00:0b:cd:ad:14:68
- -v verbose
DHCP socket: 3
Error: Could not set hardware address of interface 'eth1'
Hardware address: 000bcdad1468
DHCPDISCOVER to 255.255.255.255 port 67
DHCPDISCOVER XID: 1946896377 (0x740B47F9)
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
recv_result_1: 338
recv_result_2: 338
receive_dhcp_packet() result: 338
receive_dhcp_packet() source: 192.168.1.1
Result=OK
DHCPOFFER from IP address 192.168.1.1
DHCPOFFER XID: 1946896377 (0x740B47F9)
DHCPOFFER chaddr: 000BCDAD1468
DHCPOFFER ciaddr: 0.0.0.0
DHCPOFFER yiaddr: 192.168.1.62
DHCPOFFER siaddr: 192.168.1.1
DHCPOFFER giaddr: 0.0.0.0
Option: 53 (0x01)
Option: 54 (0x04)
Option: 51 (0x04)
Option: 1 (0x04)
Option: 3 (0x04)
Option: 6 (0x0C)
Option: 58 (0x04)
Option: 59 (0x04)
Lease Time: 600 seconds
Renewal Time: 300 seconds
Rebinding Time: 525 seconds
Added offer from server @ 192.168.1.1 of IP address 192.168.1.62
No (more) data received
Result=ERROR
Total responses seen on the wire: 1
Valid responses for this machine: 1
DHCP ok: Received 1 DHCPOFFER(s), max lease time = 600 sec.