-4

I'm just learning about DNS records, and it seems that MX records are redundant.

My understanding of MX records is as such: If I ask my DNS about an email address, then my DNS will look at a MX record to determine what IP to send my mail to.

But that doesn't seem to be any different than an A record. If I ask my DNS about a domain, then my DNS will look at an A record to determine what IP to send my queries to.

If I submitted a POST request to a URL, with a file as part of the query, then I could accomplish what email does without the need for a MX record. (And because we're all using mail applications anyway, this doesn't seem harder on the end user). However, I have no idea what this difference means to the network engineer, or DNS admin. I don't even know enough to know WHO it would matter to.

So I ask: Why does mail need to have (or get to have) its own special DNS record type? Are MX records an artifact of how things used to be? What am I missing?

Ari Sweedler
  • 113
  • 3

2 Answers2

4

MX records are intended to point a domain's mail at a different set of servers. Absent MX records, MTAs will attempt to deliver to the A record, if it exists.

StackOverflow's web traffic is pointed to 151.101.1.69 (among several others), but mail is pointed to aspmx.l.google.com (among several others). Without MX records, that split of responsibility would not be possible.

ceejayoz
  • 32,469
  • 7
  • 81
  • 105
  • Or, to be precise, `MX` records is the solution used for split responsibility in this case, rather than the only possible solution. There could have been other ways like specific subdomain, just like DKIM does while having the possibility of more than one *selector* for a single domain. – Esa Jokinen Sep 01 '17 at 18:44
  • I understand that MX records point to different servers, my appologies if that wasn't clear in my question. What I'm getting from your answer is that MX records are already not necessary. If I wanted my mail to be on another domain, I wouldn't need MX records to do that - I could just port forward (at the cost of my server being used as a proxy) or something like that. After looking at @Håkan Lindqvist's answer I see that this is exactly what SRV records allow. Neat! – Ari Sweedler Sep 01 '17 at 20:36
4

I would agree that the MX type is redundant in the sense that MX is pretty much a purpose-specific limited version of SRV.

Regarding that point, that's easily explained by how MX is much older than the much more generic SRV type.

As for having service-specific records (such as SRV or MX) it makes a lot of sense, as it allows you to use the same name for different services, without the necessity of having them all available on the same IP addresses (eg, you can make use of services hosted by different providers).

In this sense it's rather HTTP/HTTPS's reliance on directly using hostnames (with A/AAAA records) that is problematic but hard to fix at this point.
Arguably the old convention of using a www prefix served as a proto-SRV solution, but that was abandoned in the name of vanity.

Håkan Lindqvist
  • 33,741
  • 5
  • 65
  • 90
  • Interesting! So SRV/MX records allow for "domain polymorphism", to steal a programming term. I can see how that would be useful, if you have a small server. Other than mail and serving hypertext, what are other applications that make strong use of SRV records? – Ari Sweedler Sep 01 '17 at 20:34
  • 1
    @AriSweedler Examples of protocols where `SRV` actually is widely used (**unlike** the previously mentioned ones): SIP, XMPP, LDAP, Kerberos, etc. While `SRV` records can hold data for any service, the clients for said service need to actually consume `SRV` records for any such records to have an effect. Generally it's more common for newer protocols, just based on inertia. – Håkan Lindqvist Sep 01 '17 at 20:58