Mauricio Tavares wrote: > On Wed, Jul 23, 2014 at 2:01 PM, <m.roth@xxxxxxxxx> wrote: >> I've a 7 box (actually, it's RHEL, but the general list there is >> moribund), and I'm trying to configure it "correctly" so that it gets >> its hostname from the DHCP server. All I've found so far is a script >> to use from hooks of some kind. *Surely* there's just a configuration >> file option somewhere.... >> > Best I found using network manager is writing a script, > dhclient-exit-hooks.d/hostname > (http://askubuntu.com/questions/104918/how-to-get-hostname-from-dhcp-server). > There is also a way to do that using systemd-networkd; I am not very > proud to say I know how to do so though. > I've been digging, and found something a) confusing and b) disturbing. But first, *does* NM use any of the /etc/sysconfig/network-scripts *other* than the ifcfg-<interface>? Specifically, does it use ifup, ifdown, and esp. ifup-post? Here's the reason: in ifup-post is the following code: # don't set hostname on ppp/slip connections if [ "$2" = "boot" -a \ "${DEVICE}" != lo -a \ "${DEVICETYPE}" != "ppp" -a \ "${DEVICETYPE}" != "slip" ]; then if need_hostname; then IPADDR=$(LANG=C ip -o -4 addr ls dev ${DEVICE} | awk '{ print $4 ; exit }') eval $(/bin/ipcalc --silent --hostname ${IPADDR} ; echo "status=$?") if [ "$status" = "0" ]; then set_hostname $HOSTNAME fi fi fi Now, that function, need_hostname, is in network-functions, and reads: need_hostname () { CHECK_HOSTNAME=$(hostname) if [ "$CHECK_HOSTNAME" = "(none)" -o "$CHECK_HOSTNAME" = "localhost" -o \ "$CHECK_HOSTNAME" = "localhost.localdomain" ]; then return 0 else return 1 fi } So it *should* be setting it... if it's called. mark _______________________________________________ CentOS mailing list CentOS@xxxxxxxxxx http://lists.centos.org/mailman/listinfo/centos