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've setting up a Hosting service, as part of that service I need to automatically create DNS records in our nameservers for all the domains hosted.

Currently I'm using the following template:

;
; [USER] - [DOMAIN]
;
$TTL    604800
@    IN    SOA    [PRIMARY-NS].    [NS-ADMIN]. (
                       [SERIAL] ; Serial
                           10800 ; Refresh
                            3600 ; Retry
                         1209600 ; Expire
                           43200 ; Negative Cache TTL
)
;
@    IN    NS    [NS1]. ; Nameserver
@    IN    NS    [NS2]. ; Nameserver
@    IN    A     [SERVER-IP] ; Primary IP
*    IN    A     [CATCH-ALL-IP] ; Catch-all IP
@    IN    MX    0 mail

What I'm interested in knowing is, if I replace the primary A record statement with a CNAME to that server's DNS entry - will there be any adverse affects? This would make IP management on my servers far easier as I would only need to update one DNS record.

@    IN    CNAME     [SERVER-DOMAIN-NAME]
*    IN    CNAME     [SERVER-DOMAIN-NAME]

Is this a good idea? Or will this only cause trouble for DNS lookups on those records?

share|improve this question
    
The data portion of a CNAME resource record is a domain name, not an IP address. A CNAME resource record is a client-side alias, from one domain name to another. –  JdeBP Jul 22 '11 at 15:27
    
@JdeBP Right, which is why it says SERVER-ADDRESS - IE: srv1.example.com instead of the IP address for that server. –  Marco Ceppi Jul 22 '11 at 15:53
    
No. That (srv1.example.com) would be a server domain name, not an address. –  JdeBP Jul 25 '11 at 16:03
add comment

1 Answer

up vote 13 down vote accepted

No, you can't do

@ IN CNAME ...

because the CNAME record type isn't allowed to co-exist with the (required) SOA and NS records that you have to have at your zone apex (or any other resource record type, for that matter, except for DNSSEC-related records).

See s3.6.2 of RFC 1034:

If a CNAME RR is present at a node, no other data should be present; this ensures that the data for a canonical name and its aliases cannot be different. This rule also insures that a cached CNAME can be used without checking with an authoritative server for other RR types.

share|improve this answer
    
I'd just symlink the zone file for all domains. –  Simon Richter Jul 17 '11 at 22:54
add comment

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.