← Back to team overview

openstack team mailing list archive

Question about hostname.

 

Hi all,

I change the machine hostname by using follow commands

$ hostname puppet-master.domain.com
$ sed -i 's/HOSTNAME=.*/HOSTNAME=puppet-master.domain.com/'
/etc/sysconfig/network

But when checking it. I got following output

$ hostnamepuppet-master.domain.com
$ hostname --long
puppet-master.domain.com.novalocal

$ hostname -A
localhost

If I add the ip-domain mapping to the /etc/hosts file, it became right.

$ echo "10.0.0.10 puppet-master.domain.com puppet-master" >> /etc/hosts
$ hostnamepuppet-master.domain.com
$ hostname --longpuppet-master.domain.com

$ hostname -Apuppet-master.domain.com

I want to know why the hosts contents affect the hostname command
-- 
Lei Zhang

Blog: http://jeffrey4l.github.com
twitter/weibo: @jeffrey4l