DOS检查域名邮件MX记录是否已经存在的方法
进行DNS查询的一个非常有用的工具是nslookup,可以使用它来查询DNS中的各种数据。除了可以在命令行下直接进行基本的DNS查询之外,直接启动nslookup将进入一个交互模式,在这里能查询各种类型的DNS数据。
DNS的名字解析数据可以有各种不同的类型,有设置这个zone的参数的SOA类型数据,有设置名字对应的IP地址的A类型数据,有设置邮件交换的MX类型数据。这些不同类型的数据均可以通过nslookup的交互模式来查询,在查询过程中可以使用 set type命令设置相应的查询类型。
如:
C:\>nslookup
Default Server: ns.hazzptt.net.cn
Address: 202.102.224.68
> set type=mx
> yahoo.com
Server: ns3.bta.net.cn
Address: 202.106.196.115
Non-authoritative answer:
yahoo.com MX preference = 5, mail exchanger = mx4.mail.yahoo.com
yahoo.com MX preference = 10, mail exchanger = mta-v18.mail.yahoo.com
yahoo.com MX preference = 1, mail exchanger = mx1.mail.yahoo.com
yahoo.com MX preference = 1, mail exchanger = mx2.mail.yahoo.com
yahoo.com MX preference = 1, mail exchanger = mx3.mail.yahoo.com
yahoo.com nameserver = ns1.yahoo.com
yahoo.com nameserver = ns3.europe.yahoo.com
yahoo.com nameserver = ns5.dcx.yahoo.com
mx4.mail.yahoo.com internet address = 216.136.129.11
mx4.mail.yahoo.com internet address = 216.136.129.13
mx4.mail.yahoo.com internet address = 216.136.129.12
mx4.mail.yahoo.com internet address = 216.136.129.4
mx4.mail.yahoo.com internet address = 216.136.129.17
mx4.mail.yahoo.com internet address = 216.136.129.18
mx4.mail.yahoo.com internet address = 216.136.129.15
mx4.mail.yahoo.com internet address = 216.136.129.14
mx4.mail.yahoo.com internet address = 216.136.129.16
mta-v18.mail.yahoo.com internet address = 216.136.129.11
mx1.mail.yahoo.com internet address = 64.157.4.87
mx1.mail.yahoo.com internet address = 64.157.4.89
mx1.mail.yahoo.com internet address = 64.157.4.86
mx2.mail.yahoo.com internet address = 64.157.4.83
mx2.mail.yahoo.com internet address = 64.157.4.84
mx2.mail.yahoo.com internet address = 64.157.4.85
mx3.mail.yahoo.com internet address = 64.157.4.81
mx3.mail.yahoo.com internet address = 64.157.4.82
ns1.yahoo.com internet address = 204.71.200.33
>
这个例子使用nslookup来查询yahoo.com这个zone的邮件服务器,需要将类型设置为mx来执行查询。
如果所要查的某域名的MX记录不存在,则出现与以下类似的提示:
C:\>nslookup
Default Server: ns3.bta.net.cn
Address: 202.106.196.115
> set type=mx
> 5555555.com.cn
Server: ns3.bta.net.cn
Address: 202.106.196.115
DNS request timed out.
timeout was 2 seconds.
*** ns3.bta.net.cn can't find 5555555.com.cn: Non-existent domain
>
用来获得DNS数据的工具还有很多,比如:dig,它能迅速返回整个zone的名字解析数据;再比如:dnswalk,它可以用来帮助查询名字服务器的设置。您可以选择其中任意一个来查找DNS的设置问题。