Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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:

127.0.0.1               localhost.localdomain localhost
[my server ip]          server7 server7

My understanding is that this file should be more like

[my server ip]    subdomain.primarydomain.com    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

2 Answers 2

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 domain.com" line in /etc/resolv.conf, then your computer will actually do a DNS lookup for "server7.domain.com".

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 godaddy.com, 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 yourdomain.com.

Then your host should be able to do a successful lookup of "server7.yourdomain.com"

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

 
discard

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.