Hire a senior Perl / Python programmer today; download my up-to-date resume (PDF)
John Bokma MexIT
freelance Perl programmer

Resolving domain names in CentOS

Monday, May 2, 2011 | 0 comments

The 23rd of April "alex" posted a message to the Dutch Linux Usenet group nl.comp.os.linux.installatie with the subject "Install Hypervm " centos". In the message "alex" asked for help since he couldn't make it work. Since I had installed CentOS in Microsoft Hyper-V several times the past year I replied to his message if he could provide some more information I might be able to help. Instead of replying back to me on Usenet "alex" emailed me with more information from which I concluded that resolving domain names in his CentOS installation running inside Microsoft Hyper-V was not working.

Since I have been very busy last week I didn't have time to look up the file with notes I made last year when I did several CentOS installations in Hyper-V for a customer of mine. Today, when sorting out my email in Thunderbird I decided to finally reply to the email in which he had explained that using ping with an IP address worked, but ping with a domain name not.

I guessed that "alex" had forgotten to add one or more DNS servers to the resolv.conf file residing in the etc directory, so in my reply I wrote to use vi to edit /etc/resolv.conf and make the file look as follows:

search localdomain

The public domain name servers I used above are provided by Level 3 Communications. In my email, however, I wrote incorrectly that the domain name servers belong to Google..

After this modification, which has to be done with sufficient (root) rights the network needs to be restarted, again with sufficient (root) rights as follows:

/etc/init.d/network restart

After which the following command should give a result:

ping -c1 google.com

The -c1 option causes the ping command to do stop after it has sent one ECHO_REQUEST packet.

Further I recommended "alex" that if he has the IP address of the domain name server (or servers) of his provider he might want to put that one first after search localdomain.

Other public Domain Name Servers

If you prefer to use Google Public DNS use the following /etc/resolv.conf:

search localdomain

And if you prefer to use OpenDNS use the following /etc/resolv.conf:

search localdomain

Don't forget to restart the network after you have made changes to /etc/resolv.conf

Public DNS related

Please post a comment | read 0 comments | RSS feed
Backup each MySQL database to a separate file bash script >
< A hike near Cosautlán cut short