I can't seem to change the hostname on my CentOS 6.5 host.
I am following the instructions I found here: http://www.rackspace.com/knowledge_center/article/centos-hostname-change
I set my /etc/hosts
like so …
[root@mig-dev-006 ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain
192.168.32.128 ost-dev-00.domain.com ost-dev-00
192.168.32.129 ost-dev-01.domain.com ost-dev-01
… then I make my /etc/sysconfig/network
file like so …
[root@mig-dev-006 ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=ost-dev-00.domain.com
NTPSERVERARGS=iburst
… then I run hostname
like so …
[root@mig-dev-006 ~]# hostname ost-dev-00.domain.com
… and then I run bash and all seems well …
[root@mig-dev-006 ~]# bash
… but when I restart my network the old hostname comes back:
[root@ost-dev-00 ~]# /etc/init.d/network restart
Shutting down interface eth0: Device state: 3 (disconnected)
[ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: Active connection state: activating
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/6
state: activated
Connection activated
[ OK ]
[root@ost-dev-00 ~]# bash
[root@mig-dev-006 ~]#
… I can't figure it out. What am I doing wrong here.
Best Answer
to change the hostname permanently, you need to change it in two places:
and: a good idea if you have any applications that need to resolve the IP of the hostname)
and then