Changing Hostname Temporarly
Example: hostname newhostname.comChanging Hostname Permanently
Edit the file /etc/sysconfig/network and change the value of HOSTNAME in it, Save and exitTo avoid dns errors edit the file /etc/hosts and create a line as below
192.168.1.50 newhostname alias
Change ip with your server ip and newhostname and alias with anything you have setup
Changing/Setting main ip
Edit the file /etc/sysconfig/network-scripts/ifcfg-eth0 and change the value of IPADDR, NETMASK , NETWORK and BROADCASTExample ifcfg-eth0 file:
DEVICE=eth0
BOOTPROTO=none
BROADCAST=192.168.1.255
IPADDR=192.168.1.50
NETMASK=255.255.255.0
NETWORK=192.168.1.0
ONBOOT=yes
USERCTL=no
PEERDNS=no
TYPE=Ethernet
Description: Dont forget to restart network after the change with below command
service network restart
Connect again using new ip if all is well.
Adding more IPs
# Copy the config file to create an alias ipcp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:1
#Now edit the new file /etc/sysconfig/network-scripts/ifcfg-eth0:1 and change "DEVICE=eth0" to "DEVICE=eth0:1" and change ip to the new ip you want to assign. Save and exit. Then use tbe below command to bring it live.
ifup eth0:1