In the past, I've always used the hostname command to set … the hostname of a Red Hat Enterprise Linux 6.X box, and edited /etc/sysconfig/network but things they've a-changed ….
In RHEL 7.3, we now use the systemd-hostnamed command.
From this: -
</snip>
NetworkManager now controls the host name using systemd-hostnamed
With this update, NetworkManager uses the systemd-hostnamed service to read and write the static host name, which is stored in the /etc/hostname file. Due to this change, manual modifications done to the /etc/hostname file are no longer picked up automatically by NetworkManager; users should change the system host name through the hostnamectl utility. Also, the use of the HOSTNAME variable in the /etc/sysconfig/network file is now deprecated. (BZ#1367916)
With this update, NetworkManager uses the systemd-hostnamed service to read and write the static host name, which is stored in the /etc/hostname file. Due to this change, manual modifications done to the /etc/hostname file are no longer picked up automatically by NetworkManager; users should change the system host name through the hostnamectl utility. Also, the use of the HOSTNAME variable in the /etc/sysconfig/network file is now deprecated. (BZ#1367916)
</snip>
Check the current hostname
hostnamectl
Static hostname: rhel72.uk.ibm.com
Transient hostname: bpm857.uk.ibm.com
Icon name: computer-vm
Chassis: vm
Machine ID: 6bbac592627f45f5b36fcba08aa95fb3
Boot ID: 6ca7b1f7d3ff4235940bb8765daf0adb
Virtualization: vmware
Operating System: Red Hat Enterprise Linux Server 7.3 (Maipo)
CPE OS Name: cpe:/o:redhat:enterprise_linux:7.3:GA:server
Kernel: Linux 3.10.0-514.2.2.el7.x86_64
Architecture: x86-64
Transient hostname: bpm857.uk.ibm.com
Icon name: computer-vm
Chassis: vm
Machine ID: 6bbac592627f45f5b36fcba08aa95fb3
Boot ID: 6ca7b1f7d3ff4235940bb8765daf0adb
Virtualization: vmware
Operating System: Red Hat Enterprise Linux Server 7.3 (Maipo)
CPE OS Name: cpe:/o:redhat:enterprise_linux:7.3:GA:server
Kernel: Linux 3.10.0-514.2.2.el7.x86_64
Architecture: x86-64
Set the new hostname
hostnamectl set-hostname bpm857.uk.ibm.com
Reboot
reboot
Check the current hostname
hostnamectl
Static hostname: bpm857.uk.ibm.com
Icon name: computer-vm
Chassis: vm
Machine ID: 6bbac592627f45f5b36fcba08aa95fb3
Boot ID: 9c1fe5e5fc324be48a5e52217ffd2496
Virtualization: vmware
Operating System: Red Hat Enterprise Linux Server 7.3 (Maipo)
CPE OS Name: cpe:/o:redhat:enterprise_linux:7.3:GA:server
Kernel: Linux 3.10.0-514.2.2.el7.x86_64
Architecture: x86-64
Icon name: computer-vm
Chassis: vm
Machine ID: 6bbac592627f45f5b36fcba08aa95fb3
Boot ID: 9c1fe5e5fc324be48a5e52217ffd2496
Virtualization: vmware
Operating System: Red Hat Enterprise Linux Server 7.3 (Maipo)
CPE OS Name: cpe:/o:redhat:enterprise_linux:7.3:GA:server
Kernel: Linux 3.10.0-514.2.2.el7.x86_64
Architecture: x86-64
No comments:
Post a Comment