Centos/RHEL stops looking for a dhcp ip

I managed to mess up my vm network a few times and the centos machines lost there DHCP address, what surprised me was that they stopped requesting an IP address, so once I fixed my KVM test machine I would have to connect to the console restart the network

I found a website http://www.cyberciti.biz/faq/rhel-centos-configure-persistent-dhcp-client/ that mentions a setting

PERSISTENT_DHCLIENT=1

That you can set in the /etc/sysconfig/network-scripts/ifcfg-eth0

So
Edit the file

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

Append line PERSISTENT_DHCLIENT=1, at the end configuration should look as follows:

DEVICE=eth0
ONBOOT=yes
BOOTPROTO=dhcp
PERSISTENT_DHCLIENT=1

Save and close the file. Restart networking service or reboot laptop / desktop to test the changes:

# /etc/init.d/networking restart

Leave a Reply

Your email address will not be published.