DNS only Cpanel invalid hostname

blaster701

Member
Mar 16, 2006
14
0
151
Hi there. This issue is probably easy to solve; but I guess it involves modification of cpanel core config through SSH.

I've deployed a new fresh server with CentOS x64 5.6 installation (DNS only installed afterwards). But... eventhough hostname is set as valid (IP dns.domain.com -> etc/hosts file) cprsrvd/WHM does not serve with the name, just with the IP and by no means in SSL (https://IP:2087 or https://dns.domain.com:2087)

Hostname was set correctly at cpanel installation, server says it's dns.domain.com, but it refuses to actually use it as a virtual host for serving HTML, launching a "Can't Find server dns.LOCALDOMAIN."

STEPS TAKEN
1. Installed from image Cent OS 5.6 x64
2. Disabled iptables, selinux. Upgraded all RPM via yum.
3. Installed DNS-only Cpanel.

Where can I find this config for cpanel within system folders? Or a script to rebuild config for cpsrvd?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
Hello :)

It's likely the hostname does not yet resolve to an IP address. Check to make sure the "A" record is properly added for the hostname. You should do this on the server where you control the DNS for the parent domain name of your hostname.

Thank you.
 

blaster701

Member
Mar 16, 2006
14
0
151
Thanks Michael for the info. Yes, properly DNS records were set (tested by external nslookup) and hostname dns.domain.com resolved to IP. I found the mess... let's see if I can explain it properly...

That server is named dns2.domain.com, an acts at the same time (has also DNS zone for) as ns2.domain.com... it's exactly the same setup as for other machine called dns1.domain.com (ns1.domain.com) which behaves as intented when requesting WHM. All zones are correct pointing to their IP addresses.

However, in this "dns2" machine in order to access WHM via browser, you can't use the hostname but the nameserver (ns2), and despite it throws a "login error" after HTTP refresh it loads and autenticates successfully...

This is what happens when trying to load WHM:
http://dns2.domain.com (2086 or SSL 2087) -> ERROR can't login, tries to serve "dns2.localdomain" HTTP pages
http://ns2.domain.com (2086 or SSL 2087) -> After login displays "login error", but a refresh via browser loads dns2.domain.com

Something messed up during cpanel setup. I would like where to fix this, as I'm used to handle apache conf, but can't figure out how cpsrvd is configured. Probably as ns2 zone was created previously than dns2 (in the cluster) it has considered ns2 as the virtual host to setup.

Many thanks in advance,
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
43
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
What do you have in /etc/hosts file specifically? Please post the contents of that file.

Next, what is in /etc/resolv.conf file? If possible, try changing the resolvers to good public ones:

Code:
nameserver 8.8.4.4
nameserver 8.8.8.8
Those would be the Google public resolvers you can use for checking the DNS detection isn't the issue.

Finally, what is in /etc/sysconfig/network file?
 

blaster701

Member
Mar 16, 2006
14
0
151
I really appreciate your help, it's not a serious issue (server works perfectly) but I'm just wondering if it could bring trouble sooner or later.
I always use google public DNS... for me the line "domain localdomain" sounds weird in resolv.conf. Should I get rid of it?

/etc/hosts
127.0.0.1 localhost
X.X.X.X dns2.domain.com dns2

(where X.X.X.X is server's IP -> OK)

cat /etc/resolv.conf
domain localdomain
nameserver 8.8.8.8
nameserver 8.8.4.4

/etc/sysconfig/network
NETWORKING="yes"
NETWORKING_IPV6="no"
GATEWAY="Y.Y.Y.Y"
HOSTNAME=dns2.domain.com
DOMAINNAME=domain.com

(where Y.Y.Y.Y is LAN router IP -> OK)
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
43
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
You could get rid of the "domain localdomain" line in /etc/resolv.conf file. I don't see anything wrong with the other files.
 

blaster701

Member
Mar 16, 2006
14
0
151
All right, that was the problem. When server received DNS request for dns2, it automatically answered localdomain because it was configured in resolv.conf, without asking public nameservers.

Many thanks, Tristan, have a great day!