Set Static IP Address in Centos

Using your favourite text editor (vi) open the default network configuration for the network adapter you wish to configure. I wish to assign a static IP to the default ethernet adapter (eth0). You will need superuser privileges so remember to use sudo

sudo vi /etc/systemconfig/network-scripts/ifcfg-eth0

For the purpose of this post I will be using the following typical network configuration.

  • Host IP Address: 192.168.0.100
  • Netmask: 255.255.255.0
  • Gateway: 192.168.0.1

Update the following highlighted fields with your relevant network settings.

DEVICE="eth0"
BOOTPROTO="static"
HWADDR="00:11:22:33:44:55" 
NM_CONTROLLED="yes"
ONBOOT="yes"
IPADDR=192.168.0.100
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
TYPE="Ethernet"
UUID="9a6aae04-2b82-4986-951a-1081c0012345"

Leave a Reply

Your email address will not be published. Required fields are marked *