How does my DHCP server know my machine's hostname when I didn't define one in dhclient.conf?

Solution 1:

OK, after a long time trawling the Internet and trying to read through man pages, I mostly figured out what's going on:

[H]ow in the heck did it know to send the server's real hostname if the configuration isn't set up to send it in the first place?

Apparently, send host-name "<hostname>", and more specifically, <hostname>, has special significance on Ubuntu. It tells dhclient to send your machine's current hostname to the DHCP server. Note that this is case-sensitive (i.e. if you type <HOSTNAME>, dhclient will send the literal text <HOSTNAME> to the DHCP server). As reported here and here, this works on Ubuntu Feisty and above, being part of a patch to (ironically) fix a problem with dhclient not sending the machine's hostname by default.

[W]hy did the first DHCP lease (for the old network) not include option host-name, but the second DHCP lease (on the new network) did include it, if I haven't touched any of the configuration files?

This just seems to be because not all DHCP servers will echo the hostname back to the client. Yesterday we still using a Linux-based ClarkConnect router as our DHCP server, which echoed the hostname back to each client. Today we disabled DHCP on that server, and switched to using the built-in DHCP server on our primary domain controller. Our DHCP leases from the PDC don't include option host-name either, but it doesn't seem to affect anything. The machines get updated in DNS, and they can all find each other by hostname.

When I run hostname, the server returns fozzie.our.domain, but dhclient.eth0.leases says the hostname option was set to fozzie (no domain). How did it know to strip off the domain?

This is me not fully understanding the intricacies of DHCP. Our DHCP server was set to configure all of our clients with our domain. I'm guessing the DHCP server was smart enough to remove the domain name portion from the hostname sent by the client.

Anyone have any corrections or clarifications to add to this answer? It still seems a bit "hand-wavy", so I won't accept it as-is.