为什么有 MX 记录? [英] Why have MX records?

查看:27
本文介绍了为什么有 MX 记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我之前问了一个问题关于 MX 记录(并感谢我从 SO'ers 收到的深思熟虑的答案).既然问题解决了,我就想回过头问一问为什么还有MX记录.

I previously asked a question regarding MX records (and appreciate the thoughtful answers I received from SO'ers). Now that that problem is resolved, I want to step back and ask why there are MX records in the first place.

具体来说:为什么 SMTP 会受到 DNS 的特殊处理?

Specifically: Why does SMTP get special treatment by DNS?

我们没有 HTTP 的 HX 记录或 FTP 的 FX 记录.似乎所有其他 Internet 协议都与 DNS 的 A 记录相处得很好.事实上,关于 MX 记录的维基百科文章指出,当前的 SMTP 规范说,如果 MX 记录对于接收者不存在,服务器应该回退到 A 记录.它还提到了 SMTP 在 DNS 之前的世界中做出的一些调整,但那是 25 年前.我们真的不再需要 MX 记录了吗?

We don't have HX records for HTTP or FX records for FTP. It seems like every other Internet protocol gets along just fine with DNS' A record. Indeed, the Wikipedia article on MX records states that the current SMTP spec says that if an MX record does not exist for a receiver, the server should fall back on an A record. It also mentions some accommodations SMTP made in a pre-DNS world, but that was 25 years ago. Do we really need MX records any more?

推荐答案

MX 记录被使用,因为需要将 SMTP 流量路由到 user@domain与该域的其他流量不同,并且 SRV 记录尚未发明.

MX records were used because there was a need for SMTP traffic to user@domain to be routed differently to other traffic for that domain, and SRV records hadn't been invented yet.

您可以在浏览器中键入 http://example.com/ 而无需 www 前缀并仍然访问所需网站的现代惯例实际上有点奇怪的.为了更详细地解释,请考虑通常如何设置区域以实现这种无前缀访问:

The modern convention that you can type http://example.com/ in your browser without a www prefix and still get to the required website is actually a bit odd. To explain in more detail, consider how a zone would normally be setup to achieve this prefix-less access:

$ORIGIN example.com
@        IN A   192.168.1.1
         IN MX mail.example.com
www      IN A  192.168.1.1
mail     IN A  192.168.1.2

因此,任何发送到 example.com 的流量都会转到该 IP 地址,而不管使用的协议是什么(除非是使用 MX 记录的电子邮件).

So, any traffic addressed to example.com goes to that IP address, regardless of the protocol in use (unless it's e-mail which will use the MX record).

在实践中,所有应用程序最好使用SRV记录,然后我们可以一起取消应用程序特定的前缀,并使用A用于其真实目的的记录 - 专门将真实的主机名映射到 IP 地址.

In practise it would be preferable for all applications to make use of SRV records, and then we could do away with the application specific prefixes all together, and use A records for their real purpose - specifically mapping real hostnames to IP addresses.

如果以这种方式使用 SRV 记录,则区域文件将如下所示:

If SRV records were used in this way that zone file would look instead like:

$ORIGIN example.com
_http._tcp IN SRV 0 0 80 www.example.com
_smtp._tcp IN SRV 0 0 25 mail.example.com
www        IN A 192.168.1.1
mail       IN A 192.168.1.2

域中的主要 A 记录实际上用于 HTTP 服务这一假设也是 Verisign 的 SiteFinder服务"引起的问题与 2003 年(简要)引入时一样多.通过拦截所有 DNS A 记录查找未知域并返回他们自己的一个地址,Verisign 打破了各种协议,这些协议假设如果 DNS 查找失败,他们可以故障转移到其他地址数据库机制.

This assumption that the primary A record at a domain is actually for HTTP service is also part of the reason why Verisign's SiteFinder "service" caused as many problems as it did when it was (briefly) introduced in 2003. By intercepting all DNS A record lookups for unknown domains and returning one of their own addresses, Verisign broke all sorts of protocols that assumed that they could fail-over to other address database mechanisms if the DNS lookup failed.

这篇关于为什么有 MX 记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆