Skip to content
Home » General » Configuring an IP Address in CENTOS

Configuring an IP Address in CENTOS

CENTOS – Configure IP Address on ifcfg-eth0

Log into the machine as root

Type:
nano /etc/sysconfig/network-scripts/ifcfg-eth0

change
BOOTPROTO=”dhcp”

to
BOOTPROTO=”static”

add
IPADDR=192.168.1.200
NETMASK=255.255.255.0
GATEWAY=192.168.1.1

leave the HWADDR line alone and on the next line down add

DNS1=192.168.1.1
DNS2=”4.2.2.2″

Change:
ONBOOT=”no”

to
ONBOOT=”yes”

and change
NM_CONTROLLED=”yes”

to
NM_CONTROLLED=”no”

file should now look like this:
DEVICE=”p1p1″
BOOTPROTO=”static”
IPADDR=”192.168.1.200″
NETMASK=”255.255.255.0″
GATEWAY=”192.168.1.1″
HWADDR=”00:12:34:56:78:90″
DNS1=”192.168.1.1″
DNS2=”4.2.2.2″
NM_CONTROLLED=”no”
ONBOOT=”yes”
TYPE=”Ethernet”
uuid=”UIHASD-ASDFASD-ASDFASDF-ADSF”
 Leave these values alone

save file
CTRL + O

and exit
CTRL + X

reboot your machine and you are all set