Let's suppose i have a domain which DNS contains 2 records:

  • a "A" record which contains an IP Address
  • a "CNAME" record which contains another domain (alias). Let's suppose this domain contains an IP to a second IP Address

My question is: Which one of the 2 IP Addresses will be answered if i ask a DNS resolution of my domain ?



2 Answers 2


You cannot have a CNAME record and other records for the same name.
If the scenario in the question is that you would have a CNAME record and an A record side by side, that is not really a concern since it is not possible.

  • There is nothing in the DNS protocol it self that prevents an implementation of a DNS server from being configured with both CNAME and A records nor that would make it impossible for a server to respond with both of them. It may be true that any correct server will refuse (and that basically all do), but the question of "what would happen in practice if ...?" is still interesting. -- In practice, load balancing across servers with inconsistent configurations could in some ways result in the appearance of this situation even with all the servers being standard compliant.
    – BCS
    Jan 5 at 17:28
  • @BCS I disagree with there is nothing in the DNS protocol it self that prevents... as it is clear in the spec that a name cannot have this combination of records. Of course the wire format can represent invalid things, including this, but the DNS protocol is more than just the wire format. As a (quick and dirty) comparison you can certainly write "slkdjfkldsj" using the English alphabet but that does not make it valid English. I really do like your point about how caching can introduce this type of inconsistency, with different zone data on different auth servers or also just over time. Jan 5 at 18:06
  • While I'll grant you are correct about it being invalid I was more pointing out that the question of "what would the result be of it happening anyway" it still relevant. As for why that's relevant; I refer you to the ever growing list of security issues that boil down to "they didn't implement it according to the spec". :0) Also, it's fun to think about.
    – BCS
    Jan 5 at 22:55

Let's assume you have a server at IP address You also have a domain called example.com. You can create an A record for example.com to point to

The format that is used for a CNAME is [name] is an alias of [target].

So if you create a CNAME name: www.example.com to a target: example.com then www.example.com will do a redirect call for example.com, which will resolve to the IP address of

CNAME resolves to A record

So basically when you create a CNAME you do not set another IP address, so you will only have one (the original A record) IP address to resolve to.

Original source of image: https://www.keycdn.com/support/what-is-a-cname-record

  • 1
    No in fact i want to know what happens if cname is targeting another domain and if this other domain contains a « A » field with a ip for example
    – Bob5421
    Jan 14, 2021 at 10:33
  • If you try to add the same CNAME to a different host you will get an error message such as: "An A, AAAA, or CNAME record with that host already exists. (Code: 81053)" Jan 14, 2021 at 10:42

You must log in to answer this question.

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