assume I have a domain with the following RRs:

domain.com.    IN A
domain.com.    IN MX      mail.domain.com.         10
*              IN MX      othermail.domain.com.    10
*              IN CNAME   domain.com.
mail           IN A

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


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:

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?


1 Answer 1


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:

$ORIGIN example.com
@         IN A
          IN MX 10  mail
*         IN A
          IN MX 10  othermail
mail      IN A
othermail IN A
  • Ok, thanks. I was under the impression that it's not advisable to have multiple A records pointing to the same IP?
    – UloPe
    Jul 13, 2009 at 14:58
  • multiple A's pointing to the same IP is perfectly normal.
    – Alnitak
    Jul 13, 2009 at 15:20

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.