Spontanious DHCP-Server: Done.

Sitting around at the GPN6 conference in Karlsruhe at the moment, I thought it’s time to write the instant DHCP server I blogged about. So I took the code from udhcpd and, instead of parsing an config file, figure out the settings myself. So I can run simpledhcpd eth0 now, and will get a DHCP server that waits for DHCP request and answers them with an IP from eth0’s subnet, the correct netmask, my own IP as the gateway and the first entry of /etc/resolv.conf as the nameserver − that’s all it needs to quickly connect any other computer to mine and, if routing is enabled, provide it with internet connectivity.

I have uploaded the simpledhcpd binary as well as debian binary (.deb) and source packages. It is all very hackish, bad code and comments are welcome.


Could you please make it look for another DHCP server on the same network at startup and abort if it finds one (by default; this could be overridable)? Otherwise you're going to make it easy for power-lusers to break networks and their admins will hate you.
#1 Ben Hutchings am 2007-06-03T03:14:09+00:00
Good point. I will put that on the TODO list before I do any „official“ or „real“ release (if there is any, depends on demand). For now I’ll leave it like that, after all it’s not much harder to brake networks using other dhcpds .
#2 Joachim Breitner (Homepage) am 2007-06-03T10:38:54+00:00
Or, you could just install avahi and use link-local addresses and multicast DNS.
#3 Martijn am 2007-06-03T18:51:51+00:00
Thanks, I know that. But what if the other computers don’t support that?
#4 Joachim Breitner (Homepage) am 2007-06-03T19:05:06+00:00
Both Windows machines and MacOS machines support link-local addresses (169.254.*), apple supports multicast dns.

And you can teach Linux machines too ;)
#5 Martijn am 2007-06-03T20:20:05+00:00

Have something to say? You can post a comment by sending an e-Mail to me at <mail@joachim-breitner.de>, and I will include it here.