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
/etc/sysconfig/network
I checked but nothing -
[root@new-host-2 ~]# cat /etc/sysconfig/network
# Created by anaconda
Set the name there and and in hosts and reboot.
Thanks. It seems the new-host-2 is a Transient hostname. Let me dig in and make changes and report back.
Run hostnamectl command lines to reset three names and restart the VM. It works great!