Changing the primary IP address of a CentOS Server

ssh to the server.

#nano /etc/sysconfig/network-scripts/ifcfg-eth0

You will find…

# =============================================================
# Network Interface Script generated by BareMetal
# =============================================================
DEVICE=eth0
BOOTPROTO=STATIC
ONBOOT=yes
IPADDR=216.55.xx.xx
NETMASK=255.255.255.0
HWADDR=6C:62:xx:xx:xx:C3

Change this line only to the new IP

IPADDR=216.55.xx.xx

Note: If you are changing to an IP on a different subnet and need to change your default gateway, this can be configured under /etc/sysconfig/network

Save the file and restart

# service network restart

Leave a Comment