assume I have a domain with the following RRs:
domain.com. IN A 1.2.3.4
domain.com. IN MX mail.domain.com. 10
* IN MX othermail.domain.com. 10
* IN CNAME domain.com.
mail IN A 1.2.3.4
I hoped this would allow me to server web pages and receive mail on any subdomain of domain.com but when I test it:
~# dig blah.domain.com MX
; <<>> DiG 9.4.3-P1 <<>> blah.domain.com MX
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 12815
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 2, ADDITIONAL: 2
<..snip..>
;; ANSWER SECTION:
blah.domain.com. 84770 IN CNAME domain.com.
domain.com. 83445 IN MX 10 mail.domain.com.
I would expect to get an answer section like so:
;; ANSWER SECTION:
blah.domain.com. 84770 IN MX 10 othermail.domain.com.
But it seems that I get the CNAME wildcard record instead of the MX.
From reading various things I found online it seems to me that this behaviour is by design (however braindead it may be).
Now my question is if it is possible in any way to have a configuration like this returning different anserws based on the record type?
Thanks.
It's perfectly possible to mix wildcard RRs of different types.
What you can't do is mix a CNAME RR with any other sort of RR (DNSSEC RRs excepted). That applies whether the RRs are wildcarded or not.
In your case what you need to do is replace the CNAME RR with an A RR, pointing at the same IP address as the main domain: