name:当前区域的名称 value:当前区域的DNS的名字,例如ns.busyops.com. ------------------------------------------------------------------ NS记录示例: busyops.com. IN NS ns1.busyops.com. busyops.com. IN NS ns2.busyops.com. busyops.com. IN NS ns3.busyops.com. IN NS ns4.busyops.com. IN NS ns5.busyops.com. -----------------------------------------------------------------
③ MX记录
一个区域可以有多条MX记录,任何一个MX记录后续都应该有一个A记录
name:当前区域的名称 value:当前区域的某邮件服务器的主机名,通常为smtp服务器,主机名之前有个0-99的数字表优先级,数字越小优先级越高 ----------------------------------------------------------------- MX记录示例: busyops.com. IN MX 0 MX1.buyops.com. busyops.com. IN MX 50 MX2.buyops.com. IN MX 99 MX3.buyops.com. -----------------------------------------------------------------
④ A记录
A记录有时也可使用泛域名解析,名称位置使用*号
name:某主机的FQDN,例如www.busyops.com. value:主机名对应的IP的 ----------------------------------------------------------------- A记录示例: www.busyops.com. IN A 59.110.216.16 www.busyops.com. IN A 1.1.1.1 busyops.com. IN A 59.110.216.16 ns1.busyops.com. IN A 59.110.216.16 ns2.busyops.com. IN A 59.110.216.16 mx1.busyops.com. IN A 59.110.216.16 mx2.busyops.com. IN A 59.110.216.16 *.busyops.com. IN A 59.110.216.16 -----------------------------------------------------------------
⑤ AAAA记录
name:FQDN
value:IPv6地址
⑥ PTR记录
name:某主机的IP地址,需要反过来写并且加上特定后缀in-addr.arpa,网络地址和后缀可以省略 value:FQDN ----------------------------------------------------------------- PTR记录示例: 16.216.110.59.in-addr.arpa. IN PTR www.busyops.com. 16.216.110.59.in-addr.arpa. IN PTR ns1.busyops.com. 16.216 IN PTR mx1.busyops.com. ------------------------------------------------------------------
⑦ CNAME记录
name:别名的FQDN value:正式的FQDN ----------------------------------------------------------------- web1.busyops.com. IN CNAME www.busyops.com. web3.busyops.com. IN CNAME wwww.busyops.com. web2.busyops.com. IN CNAME busyops.com. ------------------------------------------------------------------
粘合记录示例:需要在.com的服务器中完成子域授权 busyops.com. IN NS ns1.busyops.com. busyops.com. IN NS ns2.busyops.com. ns1.busyops.com. IN A 59.110.216.16 ns2.busyops.com. IN A 59.110.216.16
$TTL 5H @ IN SOA @ admin.busyops.com. ( 2022022001 1H 10M 3D 1D )
IN NS ns1.busyops.com. IN NS ns2.busyops.com. IN MX 10 mx1.busyops.com. IN MX 20 mx2.busyops.com.
IN A 59.110.216.16 ns1.busyops.com. IN A 59.110.216.16 ns2.busyops.com. IN A 59.110.216.16 mx1.busyops.com. IN A 59.110.216.16 mx2.busyops.com. IN A 59.110.216.16 www.busyops.com. IN A 59.110.216.16 www.busyops.com. IN A 192.168.1.251 web.busyops.com. IN CNAME www.busyops.com. *.busyops.com. IN A 59.110.216.16
[root@node1 ~]# ll /var/named/busyops.com.zone -rw-r-----. 1 root named 505 Feb 2001:10 /var/named/busyops.com.zone
$TTL 5H @ IN SOA @ admin.busyops.com. ( 2022022001 1H 10M 3D 1D )
IN NS ns1.busyops.com. IN NS ns2.busyops.com. IN NS ns3.busyops.com. IN MX 10 mx1.busyops.com. IN MX 20 mx2.busyops.com. IN A 59.110.216.16 ns1.busyops.com. IN A 59.110.216.16 ns2.busyops.com. IN A 59.110.216.16 ns3.busyops.com. IN A 192.168.1.250 mx1.busyops.com. IN A 59.110.216.16 mx2.busyops.com. IN A 59.110.216.16 www.busyops.com. IN A 59.110.216.16 www.busyops.com. IN A 192.168.1.251 web.busyops.com. IN CNAME www.busyops.com. *.busyops.com. IN A 59.110.216.16
(3)主和从都重新加载配置文件
检查配置文件语法:named-checkconf
重载配置文件:rndc reload
接着就可以在从服务器上看到同步过来的区域文件
如果主服务器更新资源记录,一定要把序列号更新且重新加载配置文件
10. 子域授权(正向解析)
在父域配置文件中定义子域授权记录,需要对要授权的子域添加NS及A记录,如最后两行。接着重读配置文件
$TTL 5H @ IN SOA @ admin.busyops.com. ( 2022022001 1H 10M 3D 1D )
IN NS ns1.busyops.com. IN MX 10 mx1.busyops.com. IN MX 20 mx2.busyops.com. ns1.busyops.com. IN A 192.168.1.200 mx1.busyops.com. IN A 192.168.1.101 mx2.busyops.com. IN A 192.168.1.102 www.busyops.com. IN A 192.168.1.103
ops.busyops.com. IN NS ns1.ops.busyops.com. ns1.ops.busyops.com. IN A 192.168.1.23
在子域DNS服务器上添加关于子域的定义
主配文件:/etc/named.rfc1912.zones zone "ops.busyops.com" IN { type master; file "ops.busyops.com.zone"; }; ------------------------------------
区域文件:/var/named/ops.busyops.com.zone $TTL 5H @ IN SOA @ mx.ops.busyops.com. ( 2022022001 3H 10M 1D 2H ) IN NS ns1.ops.busyops.com. ns1.ops.busyops.com. IN A 192.168.1.23 www.ops.busyops.com. IN A 192.168.1.25
第三段:问题段,显示你要查询的问题 ---------------------------------------------------------------------- ;; QUESTION SECTION: ;busyops.com. IN A ----------------------------------------------------------------------
第四段:答案段,显示答案 ---------------------------------------------------------------------- ;; ANSWER SECTION: busyops.com. 123 IN A 59.110.216.16 ----------------------------------------------------------------------
第五段:权威段,显示负责解析的服务器 ---------------------------------------------------------------------- ;; AUTHORITY SECTION: busyops.com. 172321 IN NS dns30.hichina.com. busyops.com. 172321 IN NS dns29.hichina.com. ----------------------------------------------------------------------
第六段:附加段,此段将权威段的内容解析为IP地址 ---------------------------------------------------------------------- ;; ADDITIONAL SECTION: dns29.hichina.com. 172321 IN A 140.205.81.29 dns29.hichina.com. 172321 IN A 39.96.153.39 dns29.hichina.com. 172321 IN A 47.118.199.199 dns29.hichina.com. 172321 IN A 106.11.141.119 dns29.hichina.com. 172321 IN A 106.11.211.59 dns29.hichina.com. 172321 IN A 106.11.211.69 dns29.hichina.com. 172321 IN A 120.76.107.39 dns29.hichina.com. 172321 IN A 139.224.142.109 dns29.hichina.com. 172321 IN A 140.205.41.19 dns29.hichina.com. 172321 IN A 140.205.81.19 dns30.hichina.com. 172321 IN A 47.118.199.197 dns30.hichina.com. 172321 IN A 106.11.141.120 dns30.hichina.com. 172321 IN A 106.11.211.60 dns30.hichina.com. 172321 IN A 106.11.211.70 dns30.hichina.com. 172321 IN A 120.76.107.37 dns30.hichina.com. 172321 IN A 139.224.142.107 dns30.hichina.com. 172321 IN A 140.205.41.20 dns30.hichina.com. 172321 IN A 140.205.81.20 dns30.hichina.com. 172321 IN A 140.205.81.30 dns30.hichina.com. 172321 IN A 39.96.153.37 dns29.hichina.com. 172321 IN AAAA 2400:3200:2000:46::1 dns30.hichina.com. 172321 IN AAAA 2400:3200:2000:49::1 ----------------------------------------------------------------------