CentOS DNS not working - Cannot resolve any hostnames [closed]
Solution 1:
Simply adding a resolver to /etc/resolv.conf
will work to configure name resolution, but might not be persistent. This is the old way of doing things and assumes your host does not have NetworkManager running. NetworkManager will attempt to manage these files for you, and if you edit them by hand you can find them overwritten. This is likely what happened since the symptom appeared after reboot.
To use this method you will also need to make sure NetworkManager is stopped and disabled.
chkconfig NetworkManager off; service NetworkManager stop
Or, you can do as the first lines of /etc/resolv.conf
suggests and configure your name servers in /etc/sysconfig/network-scripts/ifcfg-eth0
(Usually eth0...)
DNS1=8.8.8.8
DNS2=8.8.4.4
DOMAIN=localdomain
Solution 2:
Based on your reslove.conf file,All content has been commented out with #. You can add this to your resolve.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
and save it. You can replace the google public dns to any dns you want. try it.