DNS can be a confusing issue indeed.
It sounds like that you host your domain's DNS services outside of
your server (and not otherwise in a cluster) if I understand your message
correctly which if that is the case is a bad idea because local zone information
overrides remote zone information and the server will automatically setup a
small zone with your hostname information.
Generally speaking what I do on most servers is setup the server to allow
"Sharing of DNS server IPs" (Tweak Settings in WHM) and then take
2 of the IP addresses on the server (usually the main shared IP plus another)
to also use as DNS server addresses. If I have the choice of a non
sequential IP or an IP on a different subnet available for the second IP,
I choose that for other reasons that become obvious if you ever
do DNS analysis checks so that the IPs don't appear to be from the
same server. If the new server is part of a cluster, I'll setup the second
IP on the other server but that is beyond the scope of this message.
The server will create a zone automatically for the hostname as
"/var/named/(
hostname.domain.com).db". I generally ignore
this and go ahead and manually add the zone for my main domain name
to the server. If I am going to host a site with the main domain then
I'll do this by adding a hosting account with the main domain or I'll just
add the DNS zone alone for the main domain used for the hostname alone
as a new zone if I am not going to host a site with that domain.
Once the zone is added by either means, I will go in and edit the zone
either through "Edit a DNS Zone" in WHM or login to the SSH shell and
go to /var/named and edit the (
domain.com).db zone file directly.
Changes made:
1. I increment the serial number to a higher number usually based
on the current date such as "2009071101" which makes sure my
changes are picked up by the rest of the world quickly.
2. I'll add the DNS servers I am going to create to be used by the
domain at the top of the zone file:
Code:
mydomain.com. 14400 IN NS ns1.mydomain.com.
mydomain.com. 14400 IN NS ns2.mydomain.com.
3. Further down the same zone file, I'll add the "A" records for those
DNS servers plus an "A" record for my server hostname where my
IP addresses selected earlier would be x.x.x.x and y.y.y.y respectively:
Code:
mydomain.com. IN A x.x.x.x
ns1.mydomain.com. IN A x.x.x.x
ns2.mydomain.com. IN A y.y.y.y
hostname.mydomain.com IN A x.x.x.x
4. I then generally add the usual entries for www, ftp, mail, etc
below those entries and make sure my MX records are correct.
5. I then usuall add a basic SPF record for the domain so
that mail servers with SPF checking will accept mail from
my server (most mail servers out there these days):
Code:
mydomain.com. IN TXT "v=spf1 ip4:x.x.x.x a mx mx:hostname.mydomain.com ~all"
6. I save the domain zone and restart my DNS server.
Code:
# service named restart
# service named status
7. The next step is to go out to the registrar where you purchased your
domain name and register the new hosts (DNS servers) as the same
names and IP addresses as what I put in the zone file and then change
the domain to actually use these new DNS servers as the main active
DNS servers for the domain name.
8. I then contact my upstream provider (if applicable) or whoever it is
who holds the ARIN registration on the IP number itself and ask them
to put in a reverse (PTR) record in there own DNS records to point the
IP address back to my server's hostname. This is an important
requirement so your mail works properly and cannot be done on your
own server unless you actually are the IP address owner directly and
the IP addresses are NOT given to you by your server provider.
Beyond that, I just fill out the information Cpanel needs regarding the
nameservers in the basic cpanel setup, resolvers, related configs, etc
so that Cpanel knows to use my new DNS hosts with the server for
all domains added to the server.
At this point, your DNS should be up and running well and any sites you
add to the server can just use the new DNS servers you created as
the main authoritative DNS servers for those domains.