CentOS 7, Networkmangler, And Hostname

Home » CentOS » CentOS 7, Networkmangler, And Hostname
CentOS 3 Comments

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….

mark

3 thoughts on - CentOS 7, Networkmangler, And Hostname

  • Mauricio Tavares wrote:
    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-? 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

  • )

    My experience with NM is from ubuntu, over there if you configure an interface in the /etc/network/interfaces file (their equivalent of /etc/sysconfig/network-scripts , it *should* not try to fondle that interface any longer. That said, the network-scripts do have a

    NM_CONTROLLED=no

    option, so NM must at least check for that. I have a feeling if you set that to yes, it will ignore the rest of the file and do its own thing.

    There is also a /etc/NetworkManager/ directory which seems to imply that NM does a lot of things on its own and ignore the old network config files. https://bugzilla.gnome.org/show_bug.cgi?idf7874 and the picture in http://serverfault.com/questions/429014/what-is-the-relation-between-networkmanager-and-network-service-in-fedora-rhel-c seem to confirm that.