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 have a website that I will be hosting the DNS for (testing purposes at first and then it will have some limited traffic).

I have set up DNS so that site.tld has an A record to the actual IP, but I don't know what to do about www.site.tld.

Both site.tld and www.site.tld will point to the same server / application so my logic tells me to add a CNAME record so that www.site.tld becomes an alias for site.tld.

BUT, I've been checking my settings with intodns.com and if I only add a CNAME for the www.site.tld it gives me the following error:

ERROR: I could not get any A records for www.site.tld!

(the error clears once I do an A record for www.site.tld to point to the actual IP)

I don't know if there is a "rule" that www should always be an A record even though it's actually pointing to the same IP / application.

Thanks for helping me understand this!

share|improve this question
3  
Did you remember to add an extra dot "." to the end of the domain in the CNAME record? It should be "www.example.com.", not "www.example.com" –  Scrivener Jan 17 '11 at 22:48
    
Can you share your cname entry? –  Sameer Jan 18 '11 at 3:32
    
Yes, they are FQDNs :). The domain name is cexa.ro –  Sorin Buturugeanu Jan 18 '11 at 6:42

2 Answers 2

The difference between having a A record vs CNAME for www would be an extra look up. In case of the CNAME the after figuring out that www is a CNAME to example.com, another look will be done for example.com.

Other than that if you are planning to use a CDN or a 3 party acceleration service then a CNAME would come into play. Example a lookup of www.google.com results in the following. Notice the difference in TTL of www.l.google.com and www.google.com

www.google.com. 36545 IN CNAME www.l.google.com.
www.l.google.com. 294 IN A 209.85.153.104

This gives the flexibility of changing the record, keeping a lower TTL, doing fancy stuff like geo redirection, if employing third party services.

In your case it doesn't matter since you are pointing both to the same IP.

share|improve this answer

There is no rule that the www. address needs to be an A record. It is very common for a web site to be a CNAME to something else. For example:

$ host www.google.com
www.google.com is an alias for www.l.google.com.

Or:

$ host www.kodak.com
www.kodak.com is an alias for www.Kodak.com.edgekey.net.

If things aren't working for you, it suggests a configuration error. Without seeing your actual DNS records it's hard to help out, but using command line tools like dig can help you debug the problem by showing you exactly what DNS records are being exposed by your name servers.

share|improve this answer
    
The actual domain is cexa.ro. I've had the CNAME deleted for the nigh and I've just re-added it. CNAME www.cexa.ro. alias for cexa.ro. From your answer and from Sameer's I understand that if the resulting IP is the same it makes no difference (I'm not concerned by the extra lookup). Thanks! –  Sorin Buturugeanu Jan 18 '11 at 6:38

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.