BIND(一)—— BIND主从
BIND(一)—— BIND主从
异类深呼吸 发表于4年前
BIND(一)—— BIND主从
  • 发表于 4年前
  • 阅读 159
  • 收藏 0
  • 点赞 0
  • 评论 0

【腾讯云】买域名送云解析+SSL证书+建站!>>>   

摘要: bind初步之主从学习

<h2 style="font-size: 24px; -webkit-print-color-adjust: exact; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding: 0px; -webkit-font-smoothing: antialiased; cursor: text; position: relative; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #cccccc; font-family: Helvetica, arial, sans-serif; margin-top: 0px !important;">BIND(一)-- BIND主从</h2> <h4 style="font-size: 16px; -webkit-print-color-adjust: exact; margin: 20px 0px 10px; padding: 0px; -webkit-font-smoothing: antialiased; cursor: text; position: relative; font-family: Helvetica, arial, sans-serif;">系统环境</h4> <pre style="margin: 15px 0px; font-size: 13px; -webkit-print-color-adjust: exact; background-color: #f8f8f8; border: 1px solid #cccccc; line-height: 19px; overflow: auto; padding: 6px 10px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="-webkit-print-color-adjust: exact; margin: 0px; padding: 0px; border: none; background-color: transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">Distribution : CentOS 6.5 <br />minimal Bind version : 9.8.2 <br />Init system : sysvinit </code></pre> <h4 style="font-size: 16px; -webkit-print-color-adjust: exact; margin: 20px 0px 10px; padding: 0px; -webkit-font-smoothing: antialiased; cursor: text; position: relative; font-family: Helvetica, arial, sans-serif;">安装之前</h4> <pre style="margin: 15px 0px; font-size: 13px; -webkit-print-color-adjust: exact; background-color: #f8f8f8; border: 1px solid #cccccc; line-height: 19px; overflow: auto; padding: 6px 10px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="-webkit-print-color-adjust: exact; margin: 0px; padding: 0px; border: none; background-color: transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">1.关闭selinux <br />2.清空防火墙 </code></pre> <h4 style="font-size: 16px; -webkit-print-color-adjust: exact; margin: 20px 0px 10px; padding: 0px; -webkit-font-smoothing: antialiased; cursor: text; position: relative; font-family: Helvetica, arial, sans-serif;">安装步骤</h4> <pre style="margin: 15px 0px; font-size: 13px; -webkit-print-color-adjust: exact; background-color: #f8f8f8; border: 1px solid #cccccc; line-height: 19px; overflow: auto; padding: 6px 10px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="-webkit-print-color-adjust: exact; margin: 0px; padding: 0px; border: none; background-color: transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">- 安装操作系统 <br />- 安装bind和bind工具 <br />- 安装bind master <br />- 安装bind slave <br />- 同步区域记录 </code></pre> <h4 style="font-size: 16px; -webkit-print-color-adjust: exact; margin: 20px 0px 10px; padding: 0px; -webkit-font-smoothing: antialiased; cursor: text; position: relative; font-family: Helvetica, arial, sans-serif;">演示环境</h4> <pre style="margin: 15px 0px; font-size: 13px; -webkit-print-color-adjust: exact; background-color: #f8f8f8; border: 1px solid #cccccc; line-height: 19px; overflow: auto; padding: 6px 10px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="-webkit-print-color-adjust: exact; margin: 0px; padding: 0px; border: none; background-color: transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">master:node128 <br />slave :node129 </code></pre> <h3 style="font-size: 18px; -webkit-print-color-adjust: exact; margin: 20px 0px 10px; padding: 0px; -webkit-font-smoothing: antialiased; cursor: text; position: relative; font-family: Helvetica, arial, sans-serif;">step1:安装bind</h3> <pre style="margin: 15px 0px; font-size: 13px; -webkit-print-color-adjust: exact; background-color: #f8f8f8; border: 1px solid #cccccc; line-height: 19px; overflow: auto; padding: 6px 10px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="-webkit-print-color-adjust: exact; margin: 0px; padding: 0px; border: none; background-color: transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">[root@node128 ~]# yum list all | grep '^bind' <br />bind.x86_64 32:9.8.2-0.23.rc1.el6_5.1 updates <br />bind-chroot.x86_64 32:9.8.2-0.23.rc1.el6_5.1 updates <br />bind-devel.i686 32:9.8.2-0.23.rc1.el6_5.1 updates <br />bind-devel.x86_64 32:9.8.2-0.23.rc1.el6_5.1 updates <br />bind-dyndb-ldap.x86_64 2.3-5.el6 base <br />bind-libs.i686 32:9.8.2-0.23.rc1.el6_5.1 updates <br />bind-libs.x86_64 32:9.8.2-0.23.rc1.el6_5.1 updates <br />bind-sdb.x86_64 32:9.8.2-0.23.rc1.el6_5.1 updates <br />bind-utils.x86_64 <br /><br />//作为最基本的dns服务器,就需要安装bind基本包和bind-utils工具包 <br /># yum install bind bind-utils -y <br /><br />[root@node128 ~]# rpm -qc bind <br />/etc/logrotate.d/named <br />/etc/named.conf //主配置文件 <br />/etc/named.iscdlv.key <br />/etc/named.rfc1912.zones //区域配置文件 <br />/etc/named.root.key <br />/etc/rndc.conf //接管bind的工具 <br />/etc/rndc.key //区域传输的key <br />/etc/sysconfig/named <br />/var/named/named.ca <br />/var/named/named.empty <br />/var/named/named.localhost <br />/var/named/named.loopback </code></pre> <h3 style="font-size: 18px; -webkit-print-color-adjust: exact; margin: 20px 0px 10px; padding: 0px; -webkit-font-smoothing: antialiased; cursor: text; position: relative; font-family: Helvetica, arial, sans-serif;">step2:最小化的master配置</h3> <pre style="margin: 15px 0px; font-size: 13px; -webkit-print-color-adjust: exact; background-color: #f8f8f8; border: 1px solid #cccccc; line-height: 19px; overflow: auto; padding: 6px 10px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="-webkit-print-color-adjust: exact; margin: 0px; padding: 0px; border: none; background-color: transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">#修改主配置文件 <br />[root@node128 ~]# vim /etc/named.conf <br /><br />options { <br />// listen-on port 53 { 127.0.0.1; }; <br />// listen-on-v6 port 53 { ::1; }; <br />// allow-query { localhost;}; <br /><br />//ps:此时就可以启动了,这时候启动的dns服务器只能起到缓存dns作用,即缓存dns服务器 </code></pre> <pre style="margin: 15px 0px; font-size: 13px; -webkit-print-color-adjust: exact; background-color: #f8f8f8; border: 1px solid #cccccc; line-height: 19px; overflow: auto; padding: 6px 10px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="-webkit-print-color-adjust: exact; margin: 0px; padding: 0px; border: none; background-color: transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">#修改区域配置文件 <br />[root@node128 ~]# /etc/named.rfc1912.zones <br />//新增一个区域 <br />zone "test.com" IN { //这个正向区域名称就是自定义的,公司内部的域名 <br />type master; <br />file "test.com.zone" //指定正向区域文件 <br />}; <br /><br />//type类型:{master | slave | forward} </code></pre> <pre style="margin: 15px 0px; font-size: 13px; -webkit-print-color-adjust: exact; background-color: #f8f8f8; border: 1px solid #cccccc; line-height: 19px; overflow: auto; padding: 6px 10px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="-webkit-print-color-adjust: exact; margin: 0px; padding: 0px; border: none; background-color: transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">#修改区域文件,新增正向解析文件,这个名称就是上面指定的名称 <br />$TTL 600 <br />@ IN SOA dns.test.com. admin.test.com. ( <br />20140601 <br />2H <br />10M <br />7D <br />6H) <br />IN NS dns <br />IN MX 10 mail <br />dns IN A 172.16.213.128 <br />mail IN A 172.16.213.140 <br />www IN A 172.16.213.130 <br />www IN A 172.16.213.131 <br />ftp IN CNAME www <br /><br />//注: <br />1.每个区域文件中必须要有一个NS记录,用来告知到某台机器上查询该区域信息 <br />2.上面的NS的值dns是省略写法,完整写法可以是 dns.test.com.(后面的“.”不可省略) <br />3.zone的记录开头如果省略,表示和上面的一条zone_name相同 <br />4.邮件中10为优先级,另外邮件记录中的@必须要用“.”代替 <br />5.可以为同一个host定义两个A记录,实现了负载均衡的作用,默认采用轮训机制 <br />6.CNAME就是别名设置 </code></pre> <pre style="margin: 15px 0px; font-size: 13px; -webkit-print-color-adjust: exact; background-color: #f8f8f8; border: 1px solid #cccccc; line-height: 19px; overflow: auto; padding: 6px 10px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="-webkit-print-color-adjust: exact; margin: 0px; padding: 0px; border: none; background-color: transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">//新增反向区域 <br />[root@node128 ~]# cp /var/named/test.com.zone /var/named/172.16.213.zone <br /><br /></code></pre> <pre style="margin: 1em 0px; padding: 5px; -webkit-print-color-adjust: exact; font-size: 12px; line-height: 18px; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; background-color: #eeeeee; border: 1px solid #dddddd; color: #444444; overflow: auto; -webkit-box-shadow: rgba(0, 0, 0, 0.0666667) 0px 1px 2px inset; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="margin: 0px; padding: 0px; -webkit-print-color-adjust: exact; line-height: normal; font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; border: none;">$TTL 600 <br />@ IN SOA dns.test.com. admin.test.com. ( <br />20140601 <br />2H <br />10M <br />7D <br />6H) <br />IN NS dns.test.com. <br />128 IN PTR dns.test.com. <br />129 IN PTR mail.test.com. <br />130 IN PTR www.test.com. <br />131 IN PTR www.test.com.</code></pre> <pre style="margin: 15px 0px; font-size: 13px; -webkit-print-color-adjust: exact; background-color: #f8f8f8; border: 1px solid #cccccc; line-height: 19px; overflow: auto; padding: 6px 10px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="-webkit-print-color-adjust: exact; margin: 0px; padding: 0px; border: none; background-color: transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">//区域文件权限和属组的设定 <br />[root@node128 named]# chown :named test.com.zone 172.16.213.zone <br />[root@node128 named]# chmod 640 test.com.zone 172.16.213.zone <br /><br />//检查区域配置文件语法 <br />[root@node128 ~]# named-checkzone test.com /var/named/test.com.zone <br />zone test.com/IN: loaded serial 20140601 <br />OK <br /><br />[root@node128 named]# named-checkzone "213.16.172.in-addr.arpa" 172.16.213.zone <br />zone 213.16.172.in-addr.arpa/IN: loaded serial 20140601 <br />OK <br /><br />//检查主配置文件语法错误 <br />[root@node128 ~]# named-checkconf //不报错就是正确 <br />[root@node128 ~]# /etc/init.d/named reload </code></pre> <h3 style="font-size: 18px; -webkit-print-color-adjust: exact; margin: 20px 0px 10px; padding: 0px; -webkit-font-smoothing: antialiased; cursor: text; position: relative; font-family: Helvetica, arial, sans-serif;">step3:测试</h3> <pre style="margin: 15px 0px; font-size: 13px; -webkit-print-color-adjust: exact; background-color: #f8f8f8; border: 1px solid #cccccc; line-height: 19px; overflow: auto; padding: 6px 10px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="-webkit-print-color-adjust: exact; margin: 0px; padding: 0px; border: none; background-color: transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">#常规检测使用dig,hostname,nslookup即可 <br />#dig完全区域传送 <br />[root@node128 named]# dig -t axfr test.com @172.16.213.128 <br /><br />test.com. 600 IN SOA dns.test.com. admin.test.com. 20140601 7200 600 604800 21600 <br />test.com. 600 IN NS dns.test.com. <br />test.com. 600 IN MX 10 mail.test.com. <br />dns.test.com. 600 IN A 172.16.213.128 <br />ftp.test.com. 600 IN CNAME www.test.com. <br />mail.test.com. 600 IN A 172.16.213.129 <br />www.test.com. 600 IN A 172.16.213.130 <br />www.test.com. 600 IN A 172.16.213.131 <br />test.com. 600 IN SOA dns.test.com. admin.test.com. 20140601 7200 600 604800 21600 <br /><br />;; Query time: 1 msec <br />;; SERVER: 172.16.213.128#53(172.16.213.128) <br />;; WHEN: Sat May 31 23:29:17 2014 <br />;; XFR size: 9 records (messages 1, bytes 229) </code></pre> <pre style="margin: 15px 0px; font-size: 13px; -webkit-print-color-adjust: exact; background-color: #f8f8f8; border: 1px solid #cccccc; line-height: 19px; overflow: auto; padding: 6px 10px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="-webkit-print-color-adjust: exact; margin: 0px; padding: 0px; border: none; background-color: transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">[root@node128 named]# dig -x 172.16.213.128 <br />;; QUESTION SECTION: <br />;128.213.16.172.in-addr.arpa. IN PTR <br /><br />;; AUTHORITY SECTION: <br />16.172.in-addr.arpa. 5 IN SOA 16.172.in-addr.arpa. . 0 28800 7200 604800 86400 </code></pre> <h2 style="font-size: 24px; -webkit-print-color-adjust: exact; margin: 20px 0px 10px; padding: 0px; -webkit-font-smoothing: antialiased; cursor: text; position: relative; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #cccccc; font-family: Helvetica, arial, sans-serif;">安装slave</h2> <blockquote style="border-left-color: #dddddd; margin: 15px 0px; padding: 0px 15px; -webkit-print-color-adjust: exact; color: #777777; font-family: Helvetica, arial, sans-serif; font-size: 14px; line-height: 22px;"> <p style="-webkit-print-color-adjust: exact; margin: 0px;">这里的slave是针对某个区域而言,这里只演示了正向区域的slave,反向解析的slave同理</p> </blockquote> <h3 style="font-size: 18px; -webkit-print-color-adjust: exact; margin: 20px 0px 10px; padding: 0px; -webkit-font-smoothing: antialiased; cursor: text; position: relative; font-family: Helvetica, arial, sans-serif;">step1:安装bind</h3> <pre style="margin: 15px 0px; font-size: 13px; -webkit-print-color-adjust: exact; background-color: #f8f8f8; border: 1px solid #cccccc; line-height: 19px; overflow: auto; padding: 6px 10px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="-webkit-print-color-adjust: exact; margin: 0px; padding: 0px; border: none; background-color: transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">[root@node129 ~]# yum install bind bind-utils -y </code></pre> <h3 style="font-size: 18px; -webkit-print-color-adjust: exact; margin: 20px 0px 10px; padding: 0px; -webkit-font-smoothing: antialiased; cursor: text; position: relative; font-family: Helvetica, arial, sans-serif;">step2:编辑配置文件</h3> <blockquote style="border-left-color: #dddddd; margin: 15px 0px; padding: 0px 15px; -webkit-print-color-adjust: exact; color: #777777; font-family: Helvetica, arial, sans-serif; font-size: 14px; line-height: 22px;"> <p style="-webkit-print-color-adjust: exact; margin: 0px;">如果有多台DNS服务器,必须为每个DNS服务器建立NS记录,否则master将不会向slave发送通知</p> </blockquote> <pre style="margin: 15px 0px; font-size: 13px; -webkit-print-color-adjust: exact; background-color: #f8f8f8; border: 1px solid #cccccc; line-height: 19px; overflow: auto; padding: 6px 10px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="-webkit-print-color-adjust: exact; margin: 0px; padding: 0px; border: none; background-color: transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">1.在master上新增关于从的NS解析 <br />[root@node129 ~]# vim /var/named/test.com.zone <br />IN NS dns2 <br />dns2 IN A 172.16.213.129 </code></pre> <pre style="margin: 15px 0px; font-size: 13px; -webkit-print-color-adjust: exact; background-color: #f8f8f8; border: 1px solid #cccccc; line-height: 19px; overflow: auto; padding: 6px 10px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="-webkit-print-color-adjust: exact; margin: 0px; padding: 0px; border: none; background-color: transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">2.修改主配置文件 <br />[root@node129 ~]# vim /etc/named.conf <br />// listen-on port 53 { 127.0.0.1; }; <br />// listen-on-v6 port 53 { ::1; }; <br />// allow-query { localhost; }; </code></pre> <pre style="margin: 15px 0px; font-size: 13px; -webkit-print-color-adjust: exact; background-color: #f8f8f8; border: 1px solid #cccccc; line-height: 19px; overflow: auto; padding: 6px 10px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="-webkit-print-color-adjust: exact; margin: 0px; padding: 0px; border: none; background-color: transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">3.新增从服务器区域配置 <br />[root@node129 ~]# vim /etc/named.rfc1912.zones <br />zone "test.com" IN { <br />type slave; <br />file "slaves/test.com.zone"; <br />masters { 172.16.213.128; }; <br />}; </code></pre> <pre style="margin: 15px 0px; font-size: 13px; -webkit-print-color-adjust: exact; background-color: #f8f8f8; border: 1px solid #cccccc; line-height: 19px; overflow: auto; padding: 6px 10px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="-webkit-print-color-adjust: exact; margin: 0px; padding: 0px; border: none; background-color: transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">4.master上修改区域配置文件 <br />[root@node128 ~]# vim /etc/named.rfc1912.zones <br />zone "test.com" IN { <br />type master; <br />file "test.com.zone"; <br />notify yes; //给区域内解析的NS发送通知 <br />allow-transfer { 172.16.213.129; }; //允许传送的地址,也就是slave的地址 <br />also-notify { 172.16.213.129; }; //只通知到某台机器 <br />}; </code></pre> <pre style="margin: 15px 0px; font-size: 13px; -webkit-print-color-adjust: exact; background-color: #f8f8f8; border: 1px solid #cccccc; line-height: 19px; overflow: auto; padding: 6px 10px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="-webkit-print-color-adjust: exact; margin: 0px; padding: 0px; border: none; background-color: transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">5.启动 <br />[root@node128 ~]# /etc/init.d/named start </code></pre> <h3 style="font-size: 18px; -webkit-print-color-adjust: exact; margin: 20px 0px 10px; padding: 0px; -webkit-font-smoothing: antialiased; cursor: text; position: relative; font-family: Helvetica, arial, sans-serif;">step3:测试</h3> <pre style="margin: 15px 0px; font-size: 13px; -webkit-print-color-adjust: exact; background-color: #f8f8f8; border: 1px solid #cccccc; line-height: 19px; overflow: auto; padding: 6px 10px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="-webkit-print-color-adjust: exact; margin: 0px; padding: 0px; border: none; background-color: transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">1.区域文件是否正确同步过来 <br />[root@node129 ~]# ll /var/named/slaves/ <br />total 4 <br />-rw-r--r-- 1 named named 418 Jun 1 15:34 test.com.zone </code></pre> <pre style="margin: 15px 0px; font-size: 13px; -webkit-print-color-adjust: exact; background-color: #f8f8f8; border: 1px solid #cccccc; line-height: 19px; overflow: auto; padding: 6px 10px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="-webkit-print-color-adjust: exact; margin: 0px; padding: 0px; border: none; background-color: transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">2.完成一次完全区域传送 <br />[root@node129 ~]# dig -t axfr test.com @172.16.213.129 <br /><br />; &lt;&lt;&gt;&gt; DiG 9.8.2rc1-RedHat-9.8.2-0.23.rc1.el6_5.1 &lt;&lt;&gt;&gt; -t axfr test.com @172.16.213.129 <br />;; global options: +cmd <br />test.com. 600 IN SOA dns.test.com. admin.test.com. 20140601 7200 600 604800 21600 <br />test.com. 600 IN MX 10 mail.test.com. <br />test.com. 600 IN NS dns.test.com. <br />dns.test.com. 600 IN A 172.16.213.128 <br />ftp.test.com. 600 IN CNAME www.test.com. <br />mail.test.com. 600 IN A 172.16.213.129 <br />www.test.com. 600 IN A 172.16.213.130 <br />www.test.com. 600 IN A 172.16.213.131 <br />test.com. 600 IN SOA dns.test.com. admin.test.com. 20140601 7200 600 604800 21600 <br />;; Query time: 0 msec <br />;; SERVER: 172.16.213.129#53(172.16.213.129) <br />;; WHEN: Sun Jun 1 15:38:51 2014 <br />;; XFR size: 9 records (messages 1, bytes 229) </code></pre> <pre style="margin: 15px 0px; font-size: 13px; -webkit-print-color-adjust: exact; background-color: #f8f8f8; border: 1px solid #cccccc; line-height: 19px; overflow: auto; padding: 6px 10px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="-webkit-print-color-adjust: exact; margin: 0px; padding: 0px; border: none; background-color: transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">3.使用nslookup进行解析测试 <br />[root@node129 ~]# nslookup <br />&gt; server 172.16.213.129 //指定查询服务器为slave <br />Default server: 172.16.213.129 <br />Address: 172.16.213.129#53 <br />&gt; set q=A //查询A记录 <br />&gt; www.test.com <br />Server: 172.16.213.129 <br />Address: 172.16.213.129#53 <br /><br />Name: www.test.com <br />Address: 172.16.213.131 <br />Name: www.test.com <br />Address: 172.16.213.130 <br />&gt; set q=NS //NS记录 <br />&gt; test.com <br />Server: 172.16.213.129 <br />Address: 172.16.213.129#53 <br /><br />test.com nameserver = dns2.test.com. <br />test.com nameserver = dns.test.com. <br />&gt; set q=MX //MX记录 <br />&gt; test.com <br />Server: 172.16.213.129 <br />Address: 172.16.213.129#53 <br /><br />test.com mail exchanger = 10 mail.test.com. </code></pre> <pre style="margin: 15px 0px; font-size: 13px; -webkit-print-color-adjust: exact; background-color: #f8f8f8; border: 1px solid #cccccc; line-height: 19px; overflow: auto; padding: 6px 10px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="-webkit-print-color-adjust: exact; margin: 0px; padding: 0px; border: none; background-color: transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">4.日志 <br />master更新配置文件,BIND日志记录在/var/log/messages中 <br />master上 <br />Jun 1 17:02:52 node128 named[1137]: reloading configuration succeeded <br />Jun 1 17:02:52 node128 named[1137]: reloading zones succeeded <br />Jun 1 17:02:52 node128 named[1137]: zone test.com/IN: loaded serial 20140606 <br />Jun 1 17:02:52 node128 named[1137]: zone test.com/IN: sending notifies (serial 20140606) <br />Jun 1 17:02:52 node128 named[1137]: client 172.16.213.129#36692: transfer of 'test.com/IN': AXFR-style IXFR started <br />Jun 1 17:02:52 node128 named[1137]: client 172.16.213.129#36692: transfer of 'test.com/IN': AXFR-style IXFR ended <br /><br />slave上 <br />Jun 1 17:12:45 node129 named[1432]: client 172.16.213.128#40901: received notify for zone 'test.com' <br />Jun 1 17:12:45 node129 named[1432]: zone test.com/IN: Transfer started. <br />Jun 1 17:12:45 node129 named[1432]: transfer of 'test.com/IN' from 172.16.213.128#53: connected using 172.16.213.129#36692 <br />Jun 1 17:12:45 node129 named[1432]: zone test.com/IN: transferred serial 20140606 <br />Jun 1 17:12:45 node129 named[1432]: transfer of 'test.com/IN' from 172.16.213.128#53: Transfer completed: 1 messages, 12 records, 285 bytes, 0.001 secs (285000 bytes/sec) <br />Jun 1 17:12:45 node129 named[1432]: zone test.com/IN: sending notifies (serial 20140606) </code></pre> <p style="-webkit-print-color-adjust: exact; margin-top: 15px; margin-right: 0px; margin-left: 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 0px !important;">到了这里,简单的主从就完成了,后面紧接着进行BIND的view和ACL</p>

标签: bind 主从
  • 打赏
  • 点赞
  • 收藏
  • 分享
共有 人打赏支持
粉丝 5
博文 46
码字总数 42368
×
异类深呼吸
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
打赏人
留言
* 支付类型
微信扫码支付
打赏金额:
已支付成功
打赏金额: