DNS中MX記錄的理解(轉)

ba發表於2007-08-15
DNS中MX記錄的理解(轉)[@more@]DNS使用MX記錄來實現郵件路由,它規定了域名的郵件伺服器要麼處理,要麼向前轉發有關該域名的郵件.處理郵件是指將其傳送給其地址所關聯的個人,向前轉發郵件是指透過SMTP協議將其傳送給其最終目的地.為了防止郵遞路由,MX記錄除了郵件交換器的域名外還有一個特殊引數:優先順序值.優先順序值是個從0 到65535的無符號整數,它給出郵件交換器的優先順序別.
優先順序值自身並不重要,關鍵在於它同其它郵件交換器的優先順序值的相對大小,優先順序值相對越小,優先順序越高.郵件總是首先試圖傳遞給優先順序值相對最小的郵件交換器.失敗後才試圖傳遞給優先順序值稍大的郵件交換器.郵件總是試遍了同一優先順序的郵件交換器,失敗後才試圖傳遞給優先順序稍低的郵件交換器.

注意你列為郵件交換器的主機必須擁有地址記錄.

下面列出幾個我用nslookup程式查詢的記錄:
lee@work:~$ nslookup
> set type=mx
> hnby.com.cn
Server: 10.10.16.60
Address: 10.10.16.60#53

Non-authoritative answer:
*** Can't find hnby.com.cn: No answer //沒有郵件交換

Authoritative answers can be found from:
hnby.com.cn
origin = dns.hnby.com.cn
mail addr = root.hnby.com.cn
serial = 2002120101
refresh = 900
retry = 600
expire = 86400
minimum = 3600
> set type=mx
> henan.gov.cn
Server: 10.10.16.60
Address: 10.10.16.60#53

Non-authoritative answer:
*** Can't find henan.gov.cn: No answer

Authoritative answers can be found from:
henan.gov.cn
origin = ns.hazzptt.net.cn
mail addr = root.ns.hazzptt.net.cn
serial = 99968011
refresh = 28899
retry = 7200
expire = 604800
minimum = 86400
> set type=mx
> yahoo.com.cn
Server: 10.10.16.60
Address: 10.10.16.60#53

Non-authoritative answer:
yahoo.com.cn mail exchanger = 10 mta-v1.mail.vip.cnb.yahoo.com. //雅虎中國的郵件交換服務

Authoritative answers can be found from:
yahoo.com.cn nameserver = ns8.yahoo.com.
yahoo.com.cn nameserver = ns9.yahoo.com.
yahoo.com.cn nameserver = ns1.yahoo.com.
yahoo.com.cn nameserver = ns3.yahoo.com.
yahoo.com.cn nameserver = ns6.yahoo.com.
ns1.yahoo.com internet address = 66.218.71.63
ns3.yahoo.com internet address = 217.12.4.104
ns6.yahoo.com internet address = 202.43.223.170
> set type=mx
> yahoo.com
Server: 10.10.16.60
Address: 10.10.16.60#53

Non-authoritative answer:
yahoo.com mail exchanger = 1 mx3.mail.yahoo.com.
yahoo.com mail exchanger = 1 mx1.mail.yahoo.com.
yahoo.com mail exchanger = 1 mx2.mail.yahoo.com.

Authoritative answers can be found from:
yahoo.com nameserver = ns1.yahoo.com.
yahoo.com nameserver = ns2.yahoo.com.
yahoo.com nameserver = ns3.yahoo.com.
yahoo.com nameserver = ns4.yahoo.com.
yahoo.com nameserver = ns5.yahoo.com.
mx3.mail.yahoo.com internet address = 4.79.181.12
mx3.mail.yahoo.com internet address = 67.28.113.10
mx3.mail.yahoo.com internet address = 4.79.181.168
mx3.mail.yahoo.com internet address = 4.79.181.134
mx3.mail.yahoo.com internet address = 67.28.113.74
mx1.mail.yahoo.com internet address = 67.28.113.71
mx1.mail.yahoo.com internet address = 67.28.113.73
mx1.mail.yahoo.com internet address = 67.28.113.19
mx1.mail.yahoo.com internet address = 4.79.181.14
mx1.mail.yahoo.com internet address = 4.79.181.15
mx1.mail.yahoo.com internet address = 4.79.181.168
mx2.mail.yahoo.com internet address = 4.79.181.135
mx2.mail.yahoo.com internet address = 4.79.181.136
mx2.mail.yahoo.com internet address = 4.79.181.168
mx2.mail.yahoo.com internet address = 67.28.113.70
mx2.mail.yahoo.com internet address = 67.28.113.72
ns1.yahoo.com internet address = 66.218.71.63
ns2.yahoo.com internet address = 66.163.169.170
ns3.yahoo.com internet address = 217.12.4.104
ns4.yahoo.com internet address = 68.142.196.63
> set type=mx
> dahew.com.cn
Server: 10.10.16.60
Address: 10.10.16.60#53

*** Can't find dahew.com.cn: No answer
> set type=mx
> dahew.com
Server: 10.10.16.60
Address: 10.10.16.60#53

Non-authoritative answer:
dahew.com mail exchanger = 10 mail1.dahew.com.

Authoritative answers can be found from:
dahew.com nameserver = ns1.dns-diy.com.
dahew.com nameserver = ns2.dns-diy.com.
mail1.dahew.com internet address = 219.156.123.177
ns1.dns-diy.com internet address = 210.51.187.81
ns1.dns-diy.com internet address = 218.16.225.50
ns1.dns-diy.com internet address = 60.191.252.66
ns2.dns-diy.com internet address = 218.107.207.123
ns2.dns-diy.com internet address = 218.85.134.143
ns2.dns-diy.com internet address = 64.84.29.59


當我們在bind中配置的時候,作如下語句:
$TTL 3h

@ SOA my.test.com. root.test.com. (
; ^^^^
;
        2000020501;序列號
3h; 3小時後重新整理
1h; 1小時後彼一時試
1w; 1周後期滿
1h) 否定快取TTL為1小時


他們有區別吧,@ 在SOA型別記錄的名字欄位中指的是當前的源,是test.com

NS IN ns.test.com.
; 名字伺服器
MX IN 10 mx.myhome.com.
; 郵件伺服器
ns.myhome.com. IN A 192.168.1.1
mx.myhome.com. IN A 192.168.1.1

事情總是在看到過之後才能真正的瞭解。科學的理性精神,但是實際的操作是需要實證主義的!

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10617731/viewspace-959064/,如需轉載,請註明出處,否則將追究法律責任。

相關文章