VMware Communities
jzhang2018
Contributor
Contributor

Where is this hostname from?

I created a CentOS 7 VM with workstation 12. I use bridged network adapter. The hostname is 'new-host-2' when I run hostname command:

[root@new-host-2 ~]# hostname

new-host-2

But in /etc/hosts, I see this:

[root@new-host-2 ~]# cat /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

[root@new-host-2 ~]#

Also in /etc/hostname, I see this:

[root@new-host-2 ~]# cat /etc/hostname

localhost.localdomain

I am wondering where is this 'new-host-2' from? I want to change the hostname to something meaningful to me.

Thanks!

J

0 Kudos
5 Replies
daphnissov
Immortal
Immortal

/etc/sysconfig/network

0 Kudos
jzhang2018
Contributor
Contributor

I checked but nothing -

[root@new-host-2 ~]# cat /etc/sysconfig/network

# Created by anaconda

0 Kudos
daphnissov
Immortal
Immortal

Set the name there and and in hosts and reboot.

0 Kudos
jzhang2018
Contributor
Contributor

Thanks. It seems the new-host-2 is a Transient hostname. Let me dig in and make changes and report back.

0 Kudos
jzhang2018
Contributor
Contributor

Run hostnamectl command lines to reset three names and restart the VM. It works great!

0 Kudos