Re: Prevent network setup from changing the hostname

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On 04/26/2015 09:19 PM, Robert Nichols wrote:
> 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 ...

Well, true to a degree. Put the file in /etc/dhcp/dhclient.d and it'll
be executed. Just make sure the script out-puts to stdout what goes into
the dhclient configuration file used by NetworkManager.

>
> 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.
>
Strange - you may have a dhcp server that accepts host names from the
clients - which of course would fit your use case. Just realize that not
all dhcp servers are setup to be that "lenient" when it comes to
preserving the host name picked by a client.

But I am happy you got it working.

-- 
Regards
  Peter Larsen

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos




[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux