Here is one annoying little problem with Debian I do believe should have gone away years ago.
I’ve just finished installing a new machine on my home network with Debian 4.0, since I use “dnsmasq” as a combined DNS/DHCP server on my network, the installation had no trouble using DHCP to pull an address for my new machine, however, following the installation I tried connecting to the new machine from another machine using it’s hostname, since dnsmasq is configured to automatically register its DHCP clients in DNS this should have just worked, alas, it didn’t.
As it turns out, Debian doesn’t send the machine’s hostname on DHCP requests by default, I guess that this might be a smart thing to do security-wise, so I looked into the “/etc/netwok/interfaces” file’s (Debian’s network configuration file) manpage looking for a way to change that default behavior.
As it turns out there is indeed such a way, one cad add a “hostname” directive to the “interfaces” file to enable sending the hostname with the DHCP request, however there are 2 key problems here:
- You most manually specify the name to be sent in the configuration file rather the have it pulled from the machine’s configuration.
- Even worse, that feature doesn’t seem to be supported by “dhcp3-client“, the default DHCP client installed with Debian.
As it turns out the way around this (other then installing a different DHCP client) is to modify dhcp3-client‘s own configuration file, “/etc/dhcp3/dhclient.conf” and add a line resembling the following:
send host-name "myhostname";
As you can see, in this case you are forced to specify the hostname in the configuration file as well.
One may ask why is all this important, well, I can see a few reasons:
- One reason the ability to send hostname with a DHCP request is rather important, is that some DHCP servers (notably Microsoft’s) do not hand out configuration unless the hostname is specified.
- One might argue that registering the hostname sent on a DHCP request in DNS, is not that important since one uses DHCP for workstations to which one does not typically attempt to connect with a hostname (or at all), however:
- DHCP is typically also used for cluster nodes
- Registering workstation names in DNS is important since various services such as SSH perform reverse-DNS resolution as a part of the authentication process
- While going to “/etc/network/interfaces” is what I’d expect when using Debian (I’d install Ubuntu if I didn’t want that level of control) having to go beyond it into the DHCP-client’s own internal files is not the kind of user-experience I’d expect from a stable and rather recent Debian release.
- I seem to recall that this problem exists on Ubuntu as well, this might prevent Ubuntu/Debian workstations from working correctly on an Active Directory domain, after years of effort spent on making these distributions “just work” on the desktop this is unacceptable.
- With regard to having the specify the hostname in the configuration files, this could become a rather nasty trap for the unwary system administrator who might try to modify the machine’s hostname in the future.
Solving this problem on the distribution level is rather simple, I see a few ways of going about it:
- Have the “hostname” directive in “/etc/netwok/interfaces” work with “dhcp3-client” as well, and maybe add an “auto-hostname” directive to allow one to have the hostname taken from the system’s configuration, all this could be implement with some quit trivial scripting, RedHad, for example, seems to accomplish that just fine.
- Have the default DHCP client in Debian be one that supports the “hostname” directive.
- One can argue that not sending the hostname with the DHCP request does not provide any additional security, it might be a wiser security/functionality trade-off to simply have the hostname sent by default.
To sum this up, I’m rather annoyed with this issue, in my view this is a rather trivial problem that should have been fixed years ago.
Update: Looking around the web I found this bug report, the reports are quite ancient, starting as early as Jul. 2002, but it seems that it was fixed in Ubuntu in Feb. 2007, by having the following line included in “/etc/dhcp3/dhclient.conf” by default (note how it also solves the problem of specifying the hostname in the file):
send host-name "<hostname>";
Its unclear if the fix made it into Debian, it seems they are still waiting for the upstream to include it, I do hope it’ll make it into the next version (god knows when would that be…), it clearly didn’t make it to the current one.