[CentOS] Prevent network setup from changing the hostname

Robert Nichols rnicholsNOSPAM at comcast.net
Mon Apr 27 01:19:06 UTC 2015


On 04/26/2015 07:57 PM, Peter Larsen wrote:
> On 04/26/2015 08:25 PM, Robert Nichols wrote:
>> On 04/26/2015 06:31 PM, Peter Larsen wrote:
>>> On 04/26/2015 07:26 PM, Robert Nichols wrote:
>>>> How can I block network setup (via NetworkManager) from changing
>>>> the machine's hostname whenever the network configuration changes?
>>>
>>> Make it a system connection instead of a user connection. Or give the
>>> host a static name on install and don't allow dhcp to override it.
>>
>
> If you move networks and you are slaving your hostname to the DHCP
> offered name, then yes. But why do that?  In /etc/dhcp/dhclient.conf you
> can configure exactly what you want and don't want from the server.
> There's a lot of options (man dhclient.conf is very helpful) but here's
> an example:

NetworkManager invokes dhclient with a generated config file that
ignores /etc/dhcp/dhclient.conf:

      dhclient ... -cf /var/run/nm-dhclient-wlan0.conf ...

I ran across another report that suggests setting HOSTNAME to
something other than "localhost.localdomain" in
/etc/sysconfig/network would fix the problem.  For the moment,
that seems to be working.

-- 
Bob Nichols     "NOSPAM" is really part of my email address.
                 Do NOT delete it.




More information about the CentOS mailing list