100% Pure

accept no imitations
Everything here is my opinion. I do not speak for your employer.
December 2006
January 2007

2006-12-27 »

Please, please, steal my idea!

Now that I'm once again spending my time in the outside world, which is mostly Weaverless (and generally happy about it), there are a few things that grate on me endlessly.

The #1 worst one, by far, is everybody else's DHCP servers. In Weaver, we spent rather heroic amounts of effort making sure the DHCP server could do two things reliably: first, your workstation will always get assigned the same address every time it makes a request (as long as that address is still available). And second, if you moved a workstation from a static IP to a DHCP-assigned IP, the DHCP server would keep handing you that old static IP you used to use, as long as it was in the DHCP pool.

Everybody else's DHCP server software just gives out a random address from the pool every time. If you release/renew, you get a different random address. And if you switch a node from static to dynamic, it gets a different random address, just like everyone else.

The "everybody else" behaviour leads to a feature requirement that everyone seems to implement, called "DHCP reservations," in which you can (manually) tell the server that a particular MAC address should always get a particular IP address. If you do this for every workstation, you can get reasonable release/renew behaviour, because your dynamic addresses aren't dynamic anymore. Well, good for you. Weaver went for years without this feature, because the way it hands out DHCP addresses makes the feature perfectly unnecessary. Just set your node to the IP you want it to use, ping something, and switch it back to DHCP, and it'll keep getting assigned the same IP forever. (Eventually we implemented reservations because it's easier to give people what they want than to convince them they don't need it.)

A related Weaver feature that I sorely miss is auto-registration of hostnames in the DNS based on their WINS broadcasts. You're not supposed to do this, of course; WINS broadcasts are for WINS, not DNS. But it's so handy, because just starting up samba on a Linux machine suddenly makes its name show up in DNS. Windows machines don't care about DNS, of course, so Windows users never cared about this feature, but if you run Linux on your network, the feature reduces your DNS name maintenance (and the need to refer to local hosts by IP address) down to approximately zero.

Now, really, if I had just one of these features - a sensible DHCP server or an auto-registering DNS - my life would be okay, because I'd plug in a new machine, and with at most a one-time admin effort, it would have a name and an effectively static IP. But with neither - which is what all non-Weaver networks have - you have machines that hop IP addresses all the time and no way to register those machines in DNS! So you can't refer to them by name or by number. Just shoot me.

So here's my plea: someone, anyone, please steal the DHCP server idea and put it into your DHCP server software. Its basic form is trivially easy: when someone does a DHCPRELEASE, ignore them. (It's effectively a "please be stupid" request, and there's no law requiring you to be stupid.) When they do a DHCPDISCOVER or DHCPREQUEST, even without asking for a particular IP, look in your lease table and see if you have any (even released or expired) leases for that MAC address already; if so, give out the same one again. If not, now you can choose that random address, exactly once per MAC address. And if you're forced to choose an address but you've run out (because the above algorithm never expires a lease), reuse the oldest one first. You could even reuse DHCPRELEASEd ones before non-released ones, which maintains the spirit of DHCPRELEASE without being stupid.

If you think about it, the above isn't actually any harder at all than the boneheaded algorithm everyone uses. But it's so much better it makes my head explode. Ouch. There it goes now.

Why would you follow me on twitter? Use RSS.
apenwarr-on-gmail.com