In Enterprise Linux 6, it is slightly different from previous versions on changing hostname. You don't have to modify /etc/resolv.conf anymore, the interface configuration file (i.e. eth0) will reflect its search domain to /etc/resolv.conf automatically.By default, modifying /etc/resolv.conf may take effect within the instance, but it will be reset by NIC configuration after reboots. Why is /etc/resolv.conf unable to be persistent after reboots? You may refer to my post for more information: How to Change DNS on Enterprise Linux 6.5.There're 3 files need to be modified in order to change hostname.
- The basic network configuration
- The interface configuration file, it's usually eth0
- The hosts file
[root@localhost ~]# vi /etc/sysconfig/network
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
[root@localhost ~]# vi /etc/hosts
127.0.0.1 primary01 primary01.example.com localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 primary01 primary01.example.com localhost localhost.localdomain localhost6 localhost6.localdomain6
Now, you can restart your server to verify the results.Further reading: How to Change DNS on Enterprise Linux 6.5.