Fedora 18 has changes w.r.t. how the hostname is handled: http://lists.fedoraproject.org/pipermail/test/2012-October/111230.html It looks like /usr/sbin/dhclient-script is reading $HOSTNAME from /etc/sysconfig/network and then passing it to /etc/sysconfig/network-scripts/ifup-post so that it is set as the hostname. However, this may only affect corner cases, I haven't studied the exact behaviour. At least in a trivial setup I couldn't reproduce anything bad: With the hostname already set in /etc/hostname and another one set in /etc/sysconfig/network, I connect to a DHCP network via NetworkManager; the hostname stored in /etc/sysconfig/network is not applied (good).
(In reply to comment #0) > It looks like /usr/sbin/dhclient-script is reading $HOSTNAME from > /etc/sysconfig/network and then passing it to > /etc/sysconfig/network-scripts/ifup-post so that it is set as the hostname. Daniel, I haven't been able to find the part you are talking about. Can you direct me to it ?
http://lists.freedesktop.org/archives/systemd-devel/2012-October/007241.html At a glance: dhclient-script runs ". /etc/sysconfig/network" then executes ifup-posts which inherits the HOSTNAME variable from the environment (presumably on purpose).
(In reply to comment #2) > then executes ifup-posts This specifically I can't find. Maybe I'm getting blind so can you tell me which line/part of dhclient-script executes ifup-post ? thanks
There may be a problem with handling of /etc/hostname, namely the system does not seem to set a new hostname from dhcp, but keeps using the one originally (during installation) written into /etc/hostname. My /etc/hostname contains XXX.YYY.ZZZ and has the same creation time as /root/anaconda-ks.cfg. The /etc/sysconfig/network contains just NETWORKING=yes The /etc/hostname does not get modified despite changed dhcp configuration of the host. There was a lot of confusion about that in earlier Fedoras: https://bugzilla.redhat.com/show_bug.cgi?id=719100 https://bugzilla.redhat.com/show_bug.cgi?id=875085 The way of "getting the hostname from dhcp" in Fedora 18 needs to be documented.
I see that simply removing /etc/hostname file results in the name set according to the dhcp.
(In reply to comment #4) > system does not > seem to set a new hostname from dhcp, but keeps using the one originally > (during installation) written into /etc/hostname. (In reply to comment #5) > I see that simply removing /etc/hostname file results in the name set > according to the dhcp. That corresponds with bug #719100, comment #1.
(In reply to Daniel Drake from comment #0) > I connect to a DHCP network via NetworkManager In that case the dhclient-script is not used at all, NM has it's own "dhclient-script". This bug seems like duplicate of bug #719100 / bug #875085. I'm closing it as those NM bugs have already been fixed. If anybody wants to reopen it, feel free to do that and please reassign it to NM because NM handles the "reading hostname from configuration files and passing it to dhclient" part.