DNS使用MX記錄來(lái)實(shí)現(xiàn)郵件路由,它規(guī)定了域名的郵件服務(wù)器要么處理,要么向前轉(zhuǎn)發(fā)有關(guān)該域名的郵件.處理郵件是指將其傳送給其地址所關(guān)聯(lián)的個(gè)人,向前轉(zhuǎn)發(fā)郵件是指通過(guò)SMTP協(xié)議將其傳送給其最終目的地.為了防止郵遞路由,MX記錄除了郵件交換器的域名外還有一個(gè)特殊參數(shù):優(yōu)先級(jí)值.優(yōu)先級(jí)值是個(gè)從0 到65535的無(wú)符號(hào)整數(shù),它給出郵件交換器的優(yōu)先級(jí)別.
優(yōu)先級(jí)值自身并不重要,關(guān)鍵在于它同其它郵件交換器的優(yōu)先級(jí)值的相對(duì)大小,優(yōu)先級(jí)值相對(duì)越小,優(yōu)先級(jí)越高.郵件總是首先試圖傳遞給優(yōu)先級(jí)值相對(duì)最小的郵件交換器.失敗后才試圖傳遞給優(yōu)先級(jí)值稍大的郵件交換器.郵件總是試遍了同一優(yōu)先級(jí)的郵件交換器,失敗后才試圖傳遞給優(yōu)先級(jí)稍低的郵件交換器.
注意你列為郵件交換器的主機(jī)必須擁有地址記錄.
下面列出幾個(gè)我用nslookup程序查詢(xún)的記錄:
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 //沒(méi)有郵件交換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 answerAuthoritative 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. //雅虎中國(guó)的郵件交換服務(wù)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.12mx3.mail.yahoo.com internet address = 67.28.113.10mx3.mail.yahoo.com internet address = 4.79.181.168mx3.mail.yahoo.com internet address = 4.79.181.134mx3.mail.yahoo.com internet address = 67.28.113.74mx1.mail.yahoo.com internet address = 67.28.113.71mx1.mail.yahoo.com internet address = 67.28.113.73mx1.mail.yahoo.com internet address = 67.28.113.19mx1.mail.yahoo.com internet address = 4.79.181.14mx1.mail.yahoo.com internet address = 4.79.181.15mx1.mail.yahoo.com internet address = 4.79.181.168mx2.mail.yahoo.com internet address = 4.79.181.135mx2.mail.yahoo.com internet address = 4.79.181.136mx2.mail.yahoo.com internet address = 4.79.181.168mx2.mail.yahoo.com internet address = 67.28.113.70mx2.mail.yahoo.com internet address = 67.28.113.72ns1.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.177ns1.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
當(dāng)我們?cè)赽ind中配置的時(shí)候,作如下語(yǔ)句:
$TTL 3h
@ SOA my.test.com. root.test.com. (
; ^^^^
;
2000020501;序列號(hào)
3h; 3小時(shí)后刷新
1h; 1小時(shí)后彼一時(shí)試
1w; 1周后期滿(mǎn)
1h) 否定緩存TTL為1小時(shí)
他們有區(qū)別吧,@ 在SOA類(lèi)型記錄的名字字段中指的是當(dāng)前的源,是test.com
NS IN ns.test.com.
; 名字服務(wù)器
MX IN 10 mx.myhome.com.
; 郵件服務(wù)器
ns.myhome.com. IN A 192.168.1.1
mx.myhome.com. IN A 192.168.1.1
事情總是在看到過(guò)之后才能真正的了解??茖W(xué)的理性精神,但是實(shí)際的操作是需要實(shí)證主義的!