DHCP Project
Big fat caveat: I wrote this in November of 1997. It is included here as a reference for educational purposes only. I hope you still find it useful as a general background for the protocol and one possible (partial) implementation. - SDG, 5/30/06
The Project
For a final project in Telecommunications and Data Communications Systems (CIS525) at Kansas State University, Department of Computing and Information Sciences, I chose to develop a DHCP client for use in the department where I work on campus. We currently are running Novell's DHCP server on our IntranetWare 4.11 server. Our workstations running Windows 95 have a DHCP client, but those running DOS/Windows 3.x do not. So I took on this project thinking it would be relatively easy. After all, a DHCP client only needs to contact the server and get an IP address, right? As my research progressed, I found that there was much more to it than that.
As it turns out, the project is still "in progress" (meaning I haven't finished it). While my investigation was very educational, my efforts did not prove to be entirely fruitful. At this point, my client properly sends the first message of the four-way handshake, but does not receive the next message from the server. I'm sure that with time and the proper snooping software (if anybody has any suggestions, let me know), I can track down my problem. As this is the last week of the semester, I do not expect to have it done before school is out.
The Links
My Documentation
My Code (see note below)
- inet.h - some global definitions
- parms.h - defines all DHCP options
- dhcp.h - define the structure of a standard DHCP message
- dhcpcli.h - client header file
- dhcpcli.cpp - the client as it stands today
Useful Links for DHCP
- RFC2131 - the latest specification for the protocol
- RFC2132 - specification for options
- dhcp.org - Resources for DHCP
- The DHCP FAQ - by John Wobus, a useful guide to DHCP
A Note on the Code
I know, it's ugly. I wrote it in C++ mainly because I had to do a little bit of file handling (much easier than in C). I intended to clean it up, split it up into seperate files, maybe even make a couple of classes. In the meantime, you can see what I learned about programming using Winsock and UDP, creating the DHCP message, and how the protocol "should" work. If you have any suggestions or constructive comments, I'd be glad to hear them.
