通配符子域和邮件服务器的 DNS 问题

DNS issue with wildcard subdomain and mail server

您好,我已经购买了一个域名,比方说 example.com 我需要在 DNS 上设置一个通配符子域,以便该网站的每个用户都有自己的子域。我在服务器上创建了一个电子邮件帐户,假设为 cutopus@cutop.us 以便用户联系网站的工作人员。

现在,例如,如果我使用以 contact@example.com 作为发件人地址的 sendmail 从服务器发送电子邮件,电子邮件将正确发送,但如果我想将电子邮件发送到 cutopus@cutop.us 电子邮件未送达。

我的DNS记录如下:

A           @               51.255.108.205    Automatic
A      mail.cutop.us        51.255.108.205    Automatic
CNAME      *                cutop.us       Automatic

MX    cutop.us              mail.cutop.us       10      Automatic

使用以下命令:

dig cutop.us

我得到以下输出:

; <<>> DiG 9.8.3-P1 <<>> cutop.us
;; global options: +cmd
;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 41051
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;cutop.us.          IN  A

;; ANSWER SECTION:
cutop.us.       1798    IN  A   51.255.108.205

;; Query time: 483 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Fri May  6 11:04:30 2016
;; MSG SIZE  rcvd: 42

并使用以下命令:

dig MX cutop.us

我得到以下输出:

; <<>> DiG 9.8.3-P1 <<>> MX example.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 61642
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;cutop.us.          IN  MX

;; AUTHORITY SECTION:
cutop.us.       1799    IN  SOA dns1.registrar-servers.com. hostmaster.registrar-servers.com. 2016050501 43200 3600 604800 3601
;; Query time: 486 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Fri May  6 11:06:43 2016
;; MSG SIZE  rcvd: 99

现在的问题是,为什么我不能发送邮件到cutopus@cutop.us

您不能向 bob@example.com 发送电子邮件的原因是您只为地址 bob@cut.op.example.com 配置了 MX 记录,以便将邮件发送到 example.com 您需要有

的 MX 记录
MX    @     mail.cutop.us       10

不幸的是,您随后会遇到 rules of DNS 的问题,它禁止在存在另一条记录的情况下使用 CNAME 记录。

If a CNAME RR is present at a node, no other data should be present; this ensures that the data for a canonical name and its aliases cannot be different. This rule also insures that a cached CNAME can be used without checking with an authoritative server for other RR types.

基本上你不能在同一级别拥有通配符记录和MX记录。