[CentOS] hostname changes

Rainer Traut tr.ml at gmx.de
Tue Jun 16 20:07:20 UTC 2009


Tom Brown schrieb:
>>
>> How do I change the hostname?
>> In particular, what is the difference between /etc/hosts and 
>> /etc/sysconfig/network files? Where should I make the changes?
>>
> 
> /etc/hosts has nothing to do with the hostname this is just a way to 
> resolve a name to an IP where DNS is not available or some other badness 
> is going on
> 
Umm, no.
There is a wierd dependency between /etc/hosts and the full qualified 
hostname:

You can fill in /etc/sysconfig/network your hostname full qualified but 
'hostname -f' still returns without domain.

Not before you change your hosts file to:
127.0.0.1 host host.fqdn
'hostname -f' comes back wrong.

I'm wondering why e.g. the domain in /etc/resolv.conf is ignored...

Rainer



More information about the CentOS mailing list