0

So I understand that A records point to an IP and CNAME records are just pointers to other A/CNAME records. What's the drawback of using only A records. Are CNAME records only for convenience and organization? For example 5 subdomains using A records to point to the same IP instead of CNAMES to the main domain.

  • One benefit is If you move the resources (websites, etc.) that the A records point to then you'll need to change all of the A records. If you have many resources then using CNAME records simplifies this. Instead of needing to change x number of A records you only need to change one A record (or a few). The CNAME records will then resolve to the new A record. – joeqwerty May 27 at 12:19
1

If you have control A records are all round better - faster to resolve and easy to understand.

CNAMES fill a niche where you are pointing to a resource you don't fully control.

Its worth noting that CNAMES are NOT "records are just pointers to other A/CNAME" records - and although common, and their behaviour is often similar, this misunderstanding has unintended consequences. A CNAME stands for Canonical Name - and it maps itself and everything to the left of it to another domain. Thus if you have MX records and CNAME records at the same level for example, the MX records will get ignored.

| improve this answer | |
  • Any idea why the drive by down vote? – davidgo May 27 at 10:21
  • No idea, I'm new here – Bojidar Stanchev May 27 at 10:23
  • There seem to be lots of downvotes here today ... I think your answer deserves better. – digijay May 27 at 18:32
  • I'm going to mark this answer as correct because I have to choose one and this one feels closer to directly answering my question, but I also appreciate the good advice in the other post as well. Thanks to both of you guys. – Bojidar Stanchev May 28 at 8:29
0

Usually my recommended DNS setup is to give hostnames A records and service names CNAME ones, let's assume you have a domain.com domain and from there you have host01 ~ host99 servers and www or mongodb service names.

First and foremost it's much better if you set your mongodb clients to connect to it via mongodb.domain.com, if you ever need to switch mongodb's hosts from host31.domain.com to host45.domain.com you don't need an IP switcheroo, just update your DNS and we're good.

Now, if mongodb.domain.com points to the same IP address as, say, host45.domain.com and one day you have to move host45 from Dallas to Rio de Janeiro, therefore a new IP address is needed, you'll have to update all unrelated hostnames (mongodb.domain.com, rabbitmq.domain.com, primary-mdb.domain.com, rs1-mdb.domain.com, etc..) to reflect that IP change at the same time as host45.domain.com, this is bound to be forgotten one week later and become an IT incident.

On the other hand if you placed mongodb.domain.com CNAME host45.domain.com all you'll need to do is updating host45's A record, everything else will follow suit.

As pointed out by @davidgo, hosts you don't own the SOA might change their IPs as well, so google.domain.com should CNAME www.google.com instead of A 172.217.28.4.

That's just what I do, I hope to have helped you guys easing up IT management with it.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.