09 September 2009
The objective for the weekend was to get a server which could accept, decode, process and respond to DHCP requests on the network. My first goal wasn’t to build a robust server – really it was to learn something new and see if it could be reasonably done. After pretty much two days of solid work (Saturday and Sunday) I had a working server. It assigns the same IP to every machine that requests an IP – but I was able to get a PHP program to handle sockets and UDP packet parsing to read and write DHCP packets correctly. That was arguably the hard part. The rest is just standard application logic.
The code is available on GitHub here: http://github.com/adinardi/phpdhcp.
What’s the plan for the future? I’m thinking of at least wrapping up the packet parsing class and have that available as a library for people to use. I don’t think it’s worth my time to finish the rest of the server. Being that I’ve already graduated and this is a critical service – there’s a good chance I won’t have the time to support it when they need it. As such it probably isn’t the best idea to actually put it in to production use there. Of course, if there are people interested in seeing this project completed – by all means let me know. I had planned on making the DHCP server part have a plug in system of changing the storage system backing the server so that it could run off a database and do things that the normal ISC DHCP server can’t be configured to do. When there’s no strict config (just an API that calls your storage system and asks for the info for some MAC address) you can make your system return whatever IP / config that makes sense for you.
CSH was interested in a system where you could have statically and dynamically assigned IPs in the same pool. We’re running out of IPs so if we can have static assignments and dynamic mixed you can conserve space by not having to segment the network arbitrarily.