Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I just installed CentOS 6.5 and configured the following files:





When I reboot the computer, ifconfig eth0 shows an IP address but the resolv.conf file is empty. All it says inside is search IM. There are no nameservers listed in the file.

However, after bootup, if I do dhclient -r to release the IP address and then type dhclient eth0 to get an IP address, resolv.conf is populated correctly with my DNS name servers.

Why isn't this happening automatically from my configuration files? I thought dhcp enabled in my ifcfg-eth0 file should take care of this.

The CentOS documentation says setting NETWORKING=yes starts networking at boot time: http://www.centos.org/docs/5/html/Deployment_Guide-en-US/s1-dhcp-configuring-client.html.

Any help is appreciated.

share|improve this question
Take the .IM off of the hostname, and try something other than localhost, or omit it altogether. –  slm Jun 18 '14 at 19:13
Incidentally the script responsible for setting the file up along with the entire eth0 device is done out of here: /etc/sysconfig/network-scripts/ifup-eth. –  slm Jun 18 '14 at 19:19

1 Answer 1

up vote 3 down vote accepted

Set NM_CONTROLLED=no and stop the Network Manager daemon and prevent it from restarting during boots:

/sbin/service   NetworkManager stop
/sbin/chkconfig NetworkManager off

Now populate your /etc/resolv.conf file according to your needs.

Otherwise, set NM_CONTROLLED=yes and leave the NetworkManager daemon running. In this case, add up to two DNS entries in the ifcfg-eth* file as, for example:


This will populate the /etc/resolv.conf file for you.

share|improve this answer
The resolv.conf file should still be getting updated irregardless. I have many headless systems without NetworkManager that get their contents from the DHCP server just fine. So something else is up here. –  slm Jun 18 '14 at 21:20
When NetworkManager is being used, it's responsible for updating /etc/resolv.conf using the data from DHCP. When it's not being used, the network service runs dhclient which in turn is responsible for writing the /etc/resolv.conf. –  Pavel Šimerda Jul 1 '14 at 7:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.