hostname automatically changed to "localhost"

Tim ignored_mailbox at yahoo.com.au
Tue Nov 16 11:10:44 UTC 2010


On Mon, 2010-11-15 at 21:15 +0700, Hoang Le wrote:
> I have tried both.
> - Changing HOSTNAME in /etc/sysconfig/network doesn't work
> - "hostname"command just temporary changes the name

If you're using DHCP, it's possibly part of the situation.

e.g. It gets assigned "192.168.0.15".  It does a reverse DNS lookup and
finds out that numerical IP resolves as "george.example.com".  The
hostname "george" is used.

That's part of the reason why people put a hostname into
their /etc/hosts file.  It doesn't set it, as such, but gives the answer
to the question what hostname is associated with my IP.  Though
shouldn't be done if you get assigned different IPs, and you want to use
the same hostname all the time, unless you're going to keep on editing
the hosts file.

e.g. /etc/hosts could have the following:

127.0.0.1  localhost.localdomain  localhost
192.168.0.15  george.example.com  george

-- 
[tim at localhost ~]$ uname -r
2.6.27.25-78.2.56.fc9.i686

Don't send private replies to my address, the mailbox is ignored.  I
read messages from the public lists.





More information about the users mailing list