Random MX resolutions

I encounter strange DNS resolutions. Since a few weeks, I encounter errors in different systems that a related to a strange DNS resolutions.
I did some dig on my machine and it resulted to a totally wrong results.

My DNS records looks like this:

Type Domain Value Priority
NS example.com pam.ns.Cloudflare.com.
NS example.com carl.ns.Cloudflare.com..
MX example.com mail.corporate-company.com 1
CNAME subdomain.example.com example.com
MX subdomain.example.com mxa.mailgun.org 10
MX subdomain.example.com mxb.mailgun.org 10

Here is the WRONG answer:
Instead of getting the MX of the subdomain, I get the record of the main domain!

$ dig @1.1.1.1 subdomain.example.com MX

; <<>> DiG 9.10.6 <<>> @1.1.1.1 subdomain.example.com MX
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 32070
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1452
;; QUESTION SECTION:
;subdomain.example.com.		IN	MX

;; ANSWER SECTION:
subdomain.example.com.	0	IN	CNAME	example.com.
example.com.		298	IN	MX	1 mail.corporate-company.com.

;; Query time: 3 msec
;; SERVER: 1.1.1.1#53(1.1.1.1)
;; WHEN: Wed Oct 10 15:25:28 CEST 2018
;; MSG SIZE  rcvd: 91

Not a minute later, I retried the exact same command and I get the RIGHT answer…

$ dig @1.1.1.1 subdomain.example.com MX

; <<>> DiG 9.10.6 <<>> @1.1.1.1 subdomain.example.com MX
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 2555
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1452
;; QUESTION SECTION:
;subdomain.example.com.		IN	MX

;; ANSWER SECTION:
subdomain.example.com.	300	IN	MX	10 mxb.mailgun.org.
subdomain.example.com.	300	IN	MX	10 mxa.mailgun.org.

;; Query time: 4 msec
;; SERVER: 1.1.1.1#53(1.1.1.1)
;; WHEN: Wed Oct 10 15:25:32 CEST 2018
;; MSG SIZE  rcvd: 99

Anybody have an idea of what is happening ?
Thanks!

I used tools like https://dnsmap.io and it confirm this buggy behavior. Some public DNS servers resolves the wrong MX:sob:

:wave: @loic,

Is `subdomain.example.com’ set to orange cloud or grey cloud in Cloudflare? Technically it is not valid to have any other records for a CNAME. Ideally you should make the record for subdomain an A record pointing to the same IP as example.

-OG

Hi Olivier,

All records are grey.

If I understand, this is not technically valid to have:

And I should:

Do you think it will solves my problem ?

What is really strange is that I don’t have the issue since a few days. And I had the problem for just some random cases.
And the records doesn’t change since a while…

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.