DNS使用MX记录来实现邮件路由
dns mx记录的解释
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
事情总是在看到过之后才能真正的了解。科学的理性精神,但是实际的操作是需要实证主义的!
上一篇:DNS服务器查询是如何进行工作的