IP check, dns resolves correctly but WHM warns wrong

phicts

Active Member
Feb 8, 2013
36
0
6
cPanel Access Level
Root Administrator
I believe my dns settings are correct as per intodns and another online dns reporting site. My three sites hosted on the same vps are also working fine and resolving.

My server provider assigned me two IPs:
xxx.xxx.xxx.x1 which is my primary IP and,
xxx.xxx.xxx.x2

In my domain registrar (namecheap), my nameservers are as follows:
dns1.mydomain.tld set to xxx.xxx.xxx.x1
dns2.mydomain.tld set to xxx.xxx.xxx.x2

In WHM, i have also the same settings in the Basic Setup, with A record set by clicking the Set A record button for each nameserver.
dns1.mydomain.tld set to xxx.xxx.xxx.x1
dns2.mydomain.tld set to xxx.xxx.xxx.x2

However, cpanel emails me that,

The hostname (hostname.domain.tld) resolves to xxx.xxx.xxx.x1. It
should resolve to xxx.xxx.xxx.x2 . Please be sure that the contents
of /etc/hosts are configured correctly, and also that there is a
correct 'A' entry for the domain in the zone file.

Some or all of these problems can be caused by /etc/resolv.conf
being setup incorrectly. Please check that file if you believe
everything else is correct.

You may be able to automatically correct this problem by using the
'Add an A entry for your hostname' option under 'Dns Functions' in
your Web Host Manager.
I have already edited my /etc/hosts so that that my hostname and IP is used. So where where do i set in WHM so that it will set as is and not as it wants me to do?

I am running Centos 6 latest version, 64-bit with WHM 11.36. Thanks in advance.
 

phicts

Active Member
Feb 8, 2013
36
0
6
cPanel Access Level
Root Administrator
my /etc/resolv.conf looks like this

nameserver 8.8.8.8
nameserver 8.8.4.4
which i do not want to edit as much as possible because if i replace them with my assigned IP, i will lose some functionalities in the DNS settings.

EDIT: SORRY for typing it as /etc/hosts in my original post.
 
Last edited:

phicts

Active Member
Feb 8, 2013
36
0
6
cPanel Access Level
Root Administrator
and here's what my /etc/hosts looks like

Code:
::1		localhost localhost.localdomain localhost6 localhost6.localdomain6
127.0.0.1		localhost.localdomain localhost localhost4.localdomain4 localhost4
# Auto-generated hostname. Please do not remove this comment.
xxx.xxx.xxx.x1		hostname
xxx.xxx.xxx.[B]x2[/B]		hostname.domain.tld hostname
uhm, looks like i need to edit the .x2 entry, right?
so how should it look like once i edit it? delete the x1 entry/line and change x2 to x1 in the last line? Thanks in advance.
 

quietFinn

Well-Known Member
Feb 4, 2006
2,041
551
493
Finland
cPanel Access Level
Root Administrator
and here's what my /etc/hosts looks like

Code:
::1		localhost localhost.localdomain localhost6 localhost6.localdomain6
127.0.0.1		localhost.localdomain localhost localhost4.localdomain4 localhost4
# Auto-generated hostname. Please do not remove this comment.
xxx.xxx.xxx.x1		hostname
xxx.xxx.xxx.[B]x2[/B]		hostname.domain.tld hostname
uhm, looks like i need to edit the .x2 entry, right?
so how should it look like once i edit it? delete the x1 entry/line and change x2 to x1 in the last line?
Yes that's right.

After that run:
Code:
/scripts/ipcheck --verbose
.
 

phicts

Active Member
Feb 8, 2013
36
0
6
cPanel Access Level
Root Administrator
I manually edited my /etc/hosts to look like this,

Code:
::1		localhost localhost.localdomain localhost6 localhost6.localdomain6
127.0.0.1		localhost.localdomain localhost localhost4.localdomain4 localhost4
xxx.xxx.xxx.[B]x1[/B]		hostname.domain.tld hostname
removing the two lines,
Code:
#auto-generated... 
xxx.xxx.xxx.x1		hostname
then i restarted DNS and run,

Code:
/scripts/ipcheck --verbose

and i got the same issue in the e-mail / notice - that it resolved to ...x1 but should resolve to x2 :-(
 

phicts

Active Member
Feb 8, 2013
36
0
6
cPanel Access Level
Root Administrator
In WHM Basic setup, my main IP is set to x.x.x.x1 but in the Add A entry under DNS function, it says my main IP is set to x.x.x.x2 so in the box below "Please confirm the IP address to use for the "A Entry" for hostname.mydomain.tld, i typed in
x.x.x.x1 and press the button.

The result says,
Adding A Entry...Bind reloading on hostname using rndc zone: [mydomain.tld]
...Done


A Entry added for hostname.mydomain.tld with address: x.x.x.x1
But this process do not actually take effect. When i recheck "add a entry to your hostname..." it still displays x.x.x.x2 as my primary IP and the same A record as x.x.x.x2 instead of my real primary ip which is x.x.x.x1 which also should be the one to which the A record must be set.
 

quietFinn

Well-Known Member
Feb 4, 2006
2,041
551
493
Finland
cPanel Access Level
Root Administrator
Edit the DNS zone of the domain mydomain.tld and change the A record for your hostname to point to the correct IP.

Personally I never use those "Assign IP address" & "Add an A entry..." buttons, I edit DNS zones manually.
 

phicts

Active Member
Feb 8, 2013
36
0
6
cPanel Access Level
Root Administrator
Edit the DNS zone of the domain mydomain.tld and change the A record for your hostname to point to the correct IP.

Personally I never use those "Assign IP address" & "Add an A entry..." buttons, I edit DNS zones manually.
Everything in my mydomain.tld points correctly to x.x.x.x1 which is my primary IP and licensed IP. The only entry for x.x.x.x2 there is for dns2.mydomain.tld which i believe is correct.

How do I manually edit the A record of my hostname? I mean which file do i edit other than /etc/hosts?

That's how /etc/resolv.conf must look like.

Did you rewrite your /etc/hosts ?
What does /etc/resolv.conf look like exactly? mine points to 8.8.8.8 and 8.8.4.4 as i would lose some DNS functionalities if i change it to assigned IP's

I did rewrite my /etc/hosts as you can see above.
 

quietFinn

Well-Known Member
Feb 4, 2006
2,041
551
493
Finland
cPanel Access Level
Root Administrator
How do I manually edit the A record of my hostname? I mean which file do i edit other than /etc/hosts?
There is one and only place, the DNS zone of the domain.
If your hostname is hostname.domain.tld then you edit the A record of it in the DNS zone of the domain domain.tld.
 

phicts

Active Member
Feb 8, 2013
36
0
6
cPanel Access Level
Root Administrator
There is one and only place, the DNS zone of the domain.
If your hostname is hostname.domain.tld then you edit the A record of it in the DNS zone of the domain domain.tld.
But like i said, it's already set correctly. The entries for A record looks like:

Code:
hostname.domain.tld. NS dns1.domain.tld
hostname.domain.tld. NS dns2.domain.tld
hostname.domain.tld. A  x.x.x.x1
localhost	             A  127.0.0.1
hostname                A  x.x.x.x1
for the main domain, the only reference to x.x.x.x2 is for the dns2.domain.tld :-(
 

phicts

Active Member
Feb 8, 2013
36
0
6
cPanel Access Level
Root Administrator
If your hostname is hostname.domain.tld then you edit the A record of it in the DNS zone of the domain domain.tld.
Do you mean i should add

Code:
hostname.mymaindomain.tld. 14400 IN A X.X.X.X1
to the DNS zone of mymaindomain.tld? it appears in the DNS Zone record of my hostname.mymaindomain.tld but that entry is missing in the DNS Zone record of my main domain (mymaindomain.tld). is it the solution or doesn't really matter?
 

simonas

Well-Known Member
Apr 21, 2013
141
0
16
Lithuania
cPanel Access Level
Root Administrator
Ok let's start from the beginning.

my /etc/hosts looks like this

nameserver 8.8.8.8
nameserver 8.8.4.4
which i do not want to edit as much as possible because if i replace them with my assigned IP, i will lose some functionalities in the DNS settings.
If it's true what you are saying, of course it won't work.
Resolv.conf is used only for resolving outgoing queries, so open

/etc/resolv.conf

and paste

nameserver 4.2.2.2
nameserver 208.67.222.222
nameserver 8.8.4.4
Save file.

Then open your /etc/hosts
Paste this text:
127.0.0.1 localhost.localdomain localhost
# Auto-generated hostname. Please do not remove this comment.
::1 localhost
256.158.67.48 subdomain.domain.com subdomain
Change the "256.158.67.48" with your server's IP and subdomain and domain keywords. For example if you have hostname : host.example.com, that line would be:

YOURIP host.example.com host
Save the file, restart the server.

Now let's talk why you want to change IP of the second nameserver?
Namecheap allows both nameservers same IP.

Different IPs, same server, still single point of failure.
I would advise to keep that spare IP for the SSL websites.

If you still insist that second nameserver would have different IP:

In WHM:
GO to Delete a DNS Zone,
search for the ns2.yourdomain.com or whatever you named your second nameserver. If it's not there go to the next step, if it is there - Delete that zone.

Go to Basic cPanel & WHM Setup

On the bottom
Nameserver 2: Click Assign IP address.
Then Add an A entry for this nameserver. ATTENTION!! Check if THE IP of the second nameserver is correct in the box. If not, paste it there and save it.
Click Save on the bottom.

This will save settings for the new users.

Now go to Edit DNS Zone
check if you see here your ns2.yourdomain.com.

Now, depending how you initially set up your server, other domain zones might have nameservers IPS in them, but they might have only nameserver names, like:

someDomain.com. 1000 NS ns1.maindomain.com
someDomain.com. 1000 NS ns2.maindomain.com

If you see there records like:
ns2.maindomain.com A SERVERIP - change that IP .

If you don't see - leave it.

If you did not screw up other DNS zones, it should work now.

You might want to Add an A Entry for Your Hostname .

Restart NAMED (DNS) service after manipulating DNS zones for changes to come into effect.
 
Last edited:

phicts

Active Member
Feb 8, 2013
36
0
6
cPanel Access Level
Root Administrator
Hi simonas. Thank you for your comprehensive reply. I'm sorry for my mistake to type that my /etc/hosts looks like 8.8.8.8 and 8.8.4.4 when it is actually my /etc/resolv.conf file.

the rest of your pointers, i believe i've already done. thanks again.
 

quietFinn

Well-Known Member
Feb 4, 2006
2,041
551
493
Finland
cPanel Access Level
Root Administrator
Do you mean i should add

Code:
hostname.mymaindomain.tld. 14400 IN A X.X.X.X1
to the DNS zone of mymaindomain.tld? it appears in the DNS Zone record of my hostname.mymaindomain.tld but that entry is missing in the DNS Zone record of my main domain (mymaindomain.tld). is it the solution or doesn't really matter?
If the hostname is host.domain.tld then the A record for host.domain.tld is in the DNS zone of the domain domain.tld.

In another reply you say you have:

Code:
hostname.domain.tld. NS dns1.domain.tld
hostname.domain.tld. NS dns2.domain.tld
hostname.domain.tld. A  x.x.x.x1
localhost	             A  127.0.0.1
hostname                A  x.x.x.x1
that is WRONG.

It should be:
Code:
domain.tld. NS dns1.domain.tld.
domain.tld. NS dns2.domain.tld.
dns1           A  x.x.x.x1
dns2           A  x.x.x.x2
hostname    A  x.x.x.x1
localhost	 A  127.0.0.1
 

phicts

Active Member
Feb 8, 2013
36
0
6
cPanel Access Level
Root Administrator
Thank you quietFinn. but all my settings are confirmed correct. What i actually needed to do was just change my primary IP by logging to SSH and edit
/etc/sysconfig/network-scripts/ifcfg-eth0 (in my case, on virtuozzo, it was actually /ifcf-venet0:0

I changed the x.x.x.x2 reference there to x.x.x.x1
run
Code:
service network restart
and that solved it.

i did have to reactivate my cPanel license in the process.

this how-to on how to change the primary IP address of WHM/cPanel server saved the day for me.

what i learned is that in my case, that Basic Setup in WHM does not always work. too bad.
 

simonas

Well-Known Member
Apr 21, 2013
141
0
16
Lithuania
cPanel Access Level
Root Administrator
Basic Setup should work all the time. Are you sure you clicked Save Changes at the bottom and no errors were displayed?

If you are talking about nameservers on that page: The root account’s default nameservers used when root creates an account.

Anyway, glad you have solved it. Good luck.
 

phicts

Active Member
Feb 8, 2013
36
0
6
cPanel Access Level
Root Administrator
If the hostname is host.domain.tld then the A record for host.domain.tld is in the DNS zone of the domain domain.tld.

It should be:
Code:
domain.tld. NS dns1.domain.tld.
domain.tld. NS dns2.domain.tld.
dns1           A  x.x.x.x1
dns2           A  x.x.x.x2
hostname    A  x.x.x.x1
localhost	 A  127.0.0.1
This is CORRECT and this is my settings for my main domain.tld

- - - Updated - - -

Quote Originally Posted by phicts View Post
Thank you quietFinn. but all my settings are confirmed correct.
If your DNS zone is as you showed in your earlier post then it is not correct.
Do you have a DNS zone for your hostname.maindomain.tld? may i know what it looks like? Thanks.
 

quietFinn

Well-Known Member
Feb 4, 2006
2,041
551
493
Finland
cPanel Access Level
Root Administrator
This is CORRECT and this is my settings for my main domain.tld

- - - Updated - - -
Yes that is right, but in post #11 you told it's like this:

Code:
hostname.domain.tld. NS dns1.domain.tld
hostname.domain.tld. NS dns2.domain.tld
hostname.domain.tld. A  x.x.x.x1
localhost	             A  127.0.0.1
hostname                A  x.x.x.x1
Do you have a DNS zone for your hostname.maindomain.tld? may i know what it looks like? Thanks.
I don't understand what you mean by "maindomain". In a dedicated server (or VPS) there is not such a thing as "main domain".

I do not have a DNS zone for the hostname of the server, instead I always have the A record for the hostname in the DNS zone of the hostname's domain.