I usually change
/etc/hosts
/etc/sysconfig/network-scripts/ifcfg-eth0 and then reboot
Login to your server (preferably via console or SSH) and switch to the root user
Open network configuration file and update it accordingly.
#root: vi /etc/sysconfig/network-scripts/ifcfg-eth0
Press “i” ( for insert ) and change the file once updated press ESC and save setting with (:w) also you have to change the host name and the default gateway of the machine.
For this you have to edit one more file
#root: vi /etc/sysconfig/network modify the configuration by using the “i” ( insert ) to change your new hostname and gateway information. After completion hit “ ESC ” and save setting using (:w )
Reboot machine using : #root : reboot or restart network by #root: service network restart.
You can now see the new IP address and host name that you had assigned.