Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm on a cpanel environment and I get a daily notification to tell me my hostname could not be resolved to ip address. Looking at my /etc/hosts file I then find this:               localhost.localdomain localhost
[my server ip]          server7 server7

My understanding is that this file should be more like

[my server ip]    subdomain

A few things come up for me:

1) Do I need to add all the subdomains in here that I'm using, ie ftp, mail, www ?

2) Is this setup actually erroneous - and if so, what is it in my WHM/Cpanel setup which has created this erroneous /etc/hosts file so that I can fix it?

share|improve this question

My assumption is that you currently using a purchased domain name and trying to associate your host with the domain name.

Check your /etc/resolv.conf file. It handles how your computer does DNS lookups.

If your computer is searching a namespace indicated by the "search" line in /etc/resolv.conf, then your computer will actually do a DNS lookup for "".

To have those names successfully resolve, your hostname must be added on the DNS server that your domain is registered on.

For example, if you have purchased a domain from, then you would go to your godaddy account and add those host records there. Then you would edit the /etc/resolv.conf file on your host, add your godaddy nameservers to the "nameservers" line, and change the "search" line to

Then your host should be able to do a successful lookup of ""

share|improve this answer
Currently everything works. I've got a WHM with a primary domain, and it all points as expected. If I visit that primary domain, I arrive at my server. I just get these daily errors - so clearly something is not configured correctly. I am told its nothing to worry about. Thanks for your pointers – willdanceforfun Apr 23 '12 at 23:35

I don't think so that you have to list all subdomains to your IP. Otherwise, i can cause few other errors, because of this, you are telling the system, that the IP of the subdomain hostnames are on it's IP, and the system is not telling the DNS to matching IP address. The Error, you've telling us, should be a problem with not resolving hostname on IP.

Which hostname, which is listed in first information box under Current Hostname - This Hostname should be in the /etc/hosts assinged to any IP or must have a valid DNS record.

share|improve this answer

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.