Can a single DNS response contain both A records and cname records? If so, would it be considered unusual or is it typical behavior?
Can a single DNS response contain both A records and cname records? If so, would it be considered unusual or is it typical behavior?
If the
A
record(s) that you refer to are for the canonical name (the "target" of theCNAME
record) rather than the query name, then this is perfectly normal.It would however be in violation of the standards to return
CNAME
andA
(or any other record) for the same name.Valid example:
Invalid example (not discouraged, invalid):
This is atypical, and in fact is contrary to the RFC. When a
CNAME
exists, there should be no other types of records for that same result.I can confirm that it is not a valid DNS response - and how it will be resolved is down to chance. If you are a DNS server admin who is doing this, then please use either A or CNAME (and preferably A).
Note:You can return any combination of other types or records, or a CNAME, but if you return a CNAME you can't return any other kind of record aside from the
RRSIG
DNSSEC signature, and any working DNS resolver will throw several fits if you try and refuse to take the answer seriously at all.