Wednesday 11 April 2012

Configuring CentOS to use DHCP

Check current IP configration of eth0. It is seen that IP address has not been assigned.

ifconfig eth0

Then, the contents of eth0 configuration file is viewed using 'cat' command.

cat /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE="eth0"
HWADDR="00:xx:xx:xx:xx:xx"
NM_CONTROLLED="yes"
ONBOOT="no"

vi is used to modify the configuration to be like this.

DEVICE="eth0"
BOOTPROTO="dhcp"
HWADDR="00:xx:xx:xx:xx:xx"
NM_CONTROLLED="yes"
ONBOOT="yes"