Bug#239121: netcfg: Use default hostname from DHCP if one is received
I looked into this and around on the web. The observations I made where:
The hostname and domain in DHCP can be treated in two ways, polling the
hostname from the server or sending it so the DNS-server can be updated
dynamically.
It is ok to default the hostname to somthing like "debian" (or "none" (see
below)) even when the hostname is set to be assigned from dhcp dynamically
(in case the dhcp client does not get started)
The hostname should not be set by netcfg to somthing that was received by dhcp
at install time. But netcfg could have the option (checkbox like) to
configure the dhcp client to dynamicaly change the hostname and domain to the
one received from a dhcp server.
The dhcp client needs to take care of changing hostname, domain, routes etc.
and reverting them back to the previous state when shutting down the
interface or releasing the lease.
old dhcp-client (v2) seems rather depreceated (look at the old bugs) and not
support this.
But in fact, the newest dhcp3-client package (and udeb) (3.0.1rc13-1) seems to
have a "more or less rewriten dhclient-script" and should now default to
anounce any non-empty hostname to the dhcp server and set the hostname to the
one received by dhcp if the localy resolved one is empty or "none" #165086
#151820
Easily configurable alternatives to the dhcp-client are dhcpcd (client deamon)
or pump. Other distros use those successfully, and thats where I had seen a
dhcp client.conf setting to use hostname=AUTO to have it retrieve it
automatically, otherwise announce the chosen hostname to the dhcp server with
the DHCPDISCOVER broadcast.
A quick overwriting only example hack for the dhcp-client hooks (probably
outdated by newer packages)
http://lugwash.org/linux-users/200312/0127.html
(see google cache if unavailable "debian hostname by dhcp")
Reply to: