Why does "nslookup -type=mx YAHOO.COMYAHOO.COMOO.COM" return a valid mail exchanger?

For the first one it returns:

Non-authoritative answer:
YAHOO.COMYAHOO.COMOO.COM        MX preference = 5, mail exchanger = mail.h-email.net

Also if you just duplicate the tld like

C:\Users\dmorri>nslookup -type=mx gmail.com.com.com.com.

You get an odd mail exchanger:

Non-authoritative answer:
gmail.com.com.com.com   MX preference = 10, mail exchanger = mx203.inbound-mx.net
gmail.com.com.com.com   MX preference = 10, mail exchanger = mx203.inbound-mx.org

How are you going to know when its really an invalid domain?

We don't want the domain look valid when it really is not!


Solution 1:

I don't know if there is really that much of a "why" to talk about, probably more a change of perspective to see this for what it is.

Someone has registered comoo.com, someone has registered com.com.

These domains exist in the real world and while you clearly don't like them, that doesn't make them invalid in any technical sense.

As with any domain, the owner can add whatever records they like (in your example for subdomains of these).

Solution 2:

The answer is pretty simple.

The domain name yahoo.comyahoo.comoo.com belongs to the owners of comoo.com, and so those people can do whatever they want with it. The reason that yahoo.comyahoo.comoo.com returns an MX record is that the owners of comoo.com decided to make it do that.

Likewise, the domain name gmail.com.com.com.com belongs to the owners of com.com, and so those people can do whatever they want with it. They have decided to make gmail.com.com.com.com return an MX record.

I'm not sure why you think these domain names are invalid, or that there's some kind of problem here. These domain names are completely valid and there's no problem. Everything is working exactly as it's supposed to.

Perhaps you're thinking that the first part of a domain name is the most significant part and the last parts are not so significant. Actually, the opposite is true: the last parts are the most significant and the first part is the least significant.

It's just like how if you send a letter to Michigan City, Indiana, then it will go to the state of Indiana, not the state of Michigan. The fact that the address starts with the word "Michigan" doesn't matter, because the most significant part of the address is the end, not the beginning.

Solution 3:

You are asking about a different domain:

# dig YAHOO.COMYAHOO.COMOO.COM MX @9.9.9.9
; <<>> DiG 9.16.8 <<>> YAHOO.COMYAHOO.COMOO.COM MX @9.9.9.9
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 5554
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;YAHOO.COMYAHOO.COMOO.COM.  IN  MX

;; ANSWER SECTION:
YAHOO.COMYAHOO.COMOO.COM. 3595  IN  MX  5 mail.h-email.net.

;; Query time: 16 msec
;; SERVER: 9.9.9.9#53(9.9.9.9)
;; WHEN: (...) 2021
;; MSG SIZE  rcvd: 85

You are receiving a mail exchange DNS answer for COMOO.COM, the last bit (and valid domain name) for your misspelled query:

# dig COMOO.COM MX @9.9.9.9

; <<>> DiG 9.16.8 <<>> COMOO.COM MX @9.9.9.9
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 3094
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;COMOO.COM.         IN  MX

;; ANSWER SECTION:
COMOO.COM.      3600    IN  MX  5 mail.h-email.net.

;; Query time: 24 msec
;; SERVER: 9.9.9.9#53(9.9.9.9)
;; WHEN: (...) 2021
;; MSG SIZE  rcvd: 70

Same for gmail.com.com.com.com - the domain com.com exists and has an MX entry which you can query. gmail.com.com.com.com looks like a machine on a subdomain of that main domain.