64

I need this for load balancing. For example, I've two azure storage accounts (say a and b) and the blob addresses for those are a.blob.core.windows.net and b.blob.core.windows.net. Both of them store identical data. Now I need to provide a single external name (say example.com) which points to both the storage accounts and should work in round robin. This can be achieved if I create two CNAME entries in DNS as following and it resolves to one of them in round robing.

  1. example.com CNAME a.blob.core.windows.net
  2. example.com CNAME b.blob.core.windows.net

But I can not create two CNAME records for a single name in Windows DNS server.

So is it ever possible?

5
  • I can't check, but I don't think you can do this with CNAMES. Try A records instead.
    – Dan
    Feb 7, 2014 at 22:13
  • 1
    @Dan The problem is going to be services that don't have a fixed IP, like an AWS Elastic Load Balancer. Given the core.windows.net I'd suspect a similar situation in Azure or something.
    – ceejayoz
    Feb 7, 2014 at 22:14
  • But with A records, I have to specify the IP address right? I prefer DNS names to IP addresses. Feb 7, 2014 at 22:15
  • why would you want to do that? azure blob storage is already setup for high availability and geo redundancy.
    – JTKH
    Mar 28, 2015 at 3:34
  • 1
    @JTKH that was because blob has a download limit of 65MB/sec or so and if I want more download limit, I thought of using more than one blob. Mar 30, 2015 at 5:41

2 Answers 2

75

Multiple CNAME records for the same fully-qualified domain name is a violation of the specs for DNS. Some versions of BIND would allow you to do this (some only if you specified the multiple-cnames yes option) and would round-robin load-balance between then but it's not technically legal.

There are not supposed to be resource records (RRs) with the same name as a CNAME and, to pick nits, that would include multiple identical CNAMEs. Quoth RFC 1034, Section 3.6.2:

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.

The letter-of-the RFC method to handle what you're doing would be with a single CNAME referring to a load-balanced "A" record.

1
17

You cannot. A CNAME makes one record another name for another. If a record could have CNAMES for two names, it wouldn't be another name for either of them, but a name for something entirely new, making a CNAME entry inappropriate.

There's likely a good way to solve your outer problem though. For example, you can have multiple A records.

5
  • can I have one CName and one A Record for the website at the same time?
    – amesh
    Jul 22, 2019 at 11:16
  • @amesh No you can't. You can't have a CNAME and A record with the same string identification, it's one or another. The best solution was given by David Schwartz. You can have multiple A records pointing to the same A records group. Dec 3, 2019 at 18:02
  • dig store.brave.com has two CNAME records
    – Aditya
    May 1, 2020 at 18:14
  • @Aditya It shows only one CNAME for store.brave.com, brave.ogn.app. That is, itself a CNAME to a CNAME. May 1, 2020 at 18:17
  • @DavidSchwartz ahh I see. Thanks !
    – Aditya
    May 1, 2020 at 18:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .