免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3921 | 回复: 6
打印 上一主题 下一主题

[DNS] [求助] 关于DNS辅服务器不会手动从主服务器更新zone文件 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-10-23 01:50 |只看该作者 |倒序浏览
本帖最后由 FlameTongue 于 2011-10-23 02:56 编辑

小弟第一次设置DNS,所有文件都设定完成以后,第一次slave里面没有文件的时候,重新启动master和slave的 named服务,slave里可以获取查询和反查询的文件,
但是如果我在master里修改了序列号(增加),然后在主机和辅dns上用 service named restart, 文件没有更新,序列号也只是第一次的时候那个序列号,
查询了一些网上的资料,找到论坛里2004年的一个帖子,和我的状态一样,但是看到最后是因为没有用rndc reload重启服务 >_<,
所以现在的问题就是,可以自动更新,但是需要等,如果想要手动更新的话,重启named以后slave不会再次更新zone文件,
但是我已经试了各种配置,包括改低刷新时间什么的,都不好用,只能求助了,下面是我的配置文件:

Master的named.conf文件:
  1. //
  2. // named.conf
  3. //
  4. // Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
  5. // server as a caching only nameserver (as a localhost DNS resolver only).
  6. //
  7. // See /usr/share/doc/bind*/sample/ for example named configuration files.
  8. //

  9. options {
  10.         listen-on port 53 { 172.16.30.97; 127.0.0.1; };
  11.         listen-on-v6 port 53 { ::1; };
  12.         directory         "/var/named";
  13.         dump-file         "/var/named/data/cache_dump.db";
  14.         statistics-file "/var/named/data/named_stats.txt";
  15.         memstatistics-file "/var/named/data/named_mem_stats.txt";
  16.         allow-query     { 172.16.0.0/16; };
  17.         recursion yes;

  18. };

  19. logging {
  20.         channel default_debug {
  21.                 file "data/named.run";
  22.                 severity dynamic;
  23.         };
  24. };

  25. zone "." IN {
  26.         type hint;
  27.         file "named.ca";
  28. };

  29. zone "0.0.127.IN-ADDR.ARPA"        IN {
  30.         type master;
  31.         file "named.loopback";
  32. };

  33. zone "example97.lab" IN {
  34.         type master;
  35.         file "example97.fzone";
  36.         allow-transfer { 172.16.31.97; };
  37.         notify yes;
  38. #        allow-update { any; };
  39. #        allow-query { any; };
  40. };

  41. zone "16.172.IN-ADDR.ARPA" IN {
  42.         type master;
  43.         file "example97.rzone";
  44.         allow-transfer { 172.16.31.97; };
  45.         notify yes;
  46. #        allow-update { any; };
  47. #        allow-query { any; };
  48. };

  49. include "/etc/named.rfc1912.zones";
复制代码
Master的 fzone 文件:
  1. ; forward zone file for example97.lab
  2. ;
  3. $TTL 86400
  4. $ORIGIN example97.lab.
  5. ;
  6. @        IN                SOA        ns.example97.lab.        root.example97.lab. (
  7.         2011101662                ; serial
  8.         1M                        ; refresh
  9.         15M                        ; retry
  10.         1W                        ; expire
  11.         1D                        ; minimum
  12. )

  13. example97.lab.        IN        NS        ns.example97.lab.
  14. example97.lab.        IN        NS        nsslave.example97.lab.

  15. ns                IN        A        172.16.30.97
  16. www                IN        A        172.16.30.97
  17. ftp                IN        A        172.16.32.97
  18. nsslave                IN        A        172.16.31.97
复制代码
Master的rzone文件
  1. ; reverse zone file for example97.lab
  2. ;
  3. $TTL 86400
  4. $ORIGIN 16.172.IN-ADDR.ARPA.
  5. @        IN        SOA        ns.example97.lab.        root.example97.lab. (
  6.         2011101662                ; serial
  7.         1M                        ; refresh
  8.         15M                        ; retry
  9.         1W                        ; expire
  10.         1D                        ; minimum
  11. )

  12. 16.172.IN-ADDR.ARPA.        IN        NS        ns.example97.lab.
  13. 16.172.IN-ADDR.ARPA.        IN        NS        nsslave.example97.lab.

  14. 97.30        IN        PTR        ns.example97.lab.
  15. 97.30        IN        PTR        www.example97.lab.
  16. 97.32        IN        PTR        ftp.example97.lab.
  17. 97.31        IN        PTR        nsslave.example97.lab.
复制代码
下面这个是slave上的named.conf文件:
  1. // named.conf
  2. //
  3. // Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
  4. // server as a caching only nameserver (as a localhost DNS resolver only).
  5. //
  6. // See /usr/share/doc/bind*/sample/ for example named configuration files.
  7. //

  8. options {
  9.         listen-on port 53 { 172.16.31.97; 127.0.0.1; };
  10.         listen-on-v6 port 53 { ::1; };
  11.         directory         "/var/named";
  12.         dump-file         "/var/named/data/cache_dump.db";
  13.         statistics-file "/var/named/data/named_stats.txt";
  14.         memstatistics-file "/var/named/data/named_mem_stats.txt";
  15.         allow-query     { 172.16.0.0/16; };
  16.         recursion yes;
  17. };

  18. logging {
  19.         channel default_debug {
  20.                 file "data/named.run";
  21.                 severity dynamic;
  22.         };
  23. };

  24. zone "." IN {
  25.         type hint;
  26.         file "named.ca";
  27. };

  28. zone "example97.lab" IN {
  29.         type slave;
  30.         file "slaves/example97.fzone";
  31.         masters { 172.16.30.97; };
  32. };

  33. zone "16.172.IN-ADDR.ARPA" IN {
  34.         type slave;
  35.         file "slaves/example97.rzone";
  36.         masters { 172.16.30.97; };
  37. };

  38. include "/etc/named.rfc1912.zones";
复制代码

论坛徽章:
0
2 [报告]
发表于 2011-10-23 02:58 |只看该作者
再问一下,

service named restart 和 rndc reload这两个命令有什么区别?

论坛徽章:
0
3 [报告]
发表于 2011-10-23 05:01 |只看该作者
新的问题又出现了,现在zone文件还是不能手动更新,
而且我用别的电脑使用我的slave DNS无法解析网址,以前一直没测,
刚才测了一下,让我泪流满面,现在完全不知道哪里错了,求指点啊~

论坛徽章:
0
4 [报告]
发表于 2011-10-23 06:16 |只看该作者
还是说,应为我的slave DNS 无法用别的电脑解析,所以没有影响到zone文件的手动更新????

论坛徽章:
0
5 [报告]
发表于 2011-10-25 17:39 |只看该作者
Master的named.conf文件:
  1. options {
  2.         // other conf content, add following line
  3.         also-notify { you.slave.ip; };

  4. };
复制代码
also-notify defines a list of IP address(es) (and optional port numbers) that will be sent a NOTIFY when a zone changes (or the specific zone if the statement is specified in a zone clause). These IP(s)s are in addition to those listed in the NS records for the zone. The also-notify in a zone is not cumulative with any global also-notify statements. If a global notify statement is 'no' this statement may be used to override it for a specific zone and, conversely, if the global options contain a also-notify list, setting notify 'no' in the zone will override the global option. This statement may be used in normal zone, view or a global options clause. While this statement would normally be used in a zone of type 'master' there is nothing to prevent its use in a 'slave' zone - in which case the NOTIFY would be triggered following a zone transfer to the slave.

论坛徽章:
0
6 [报告]
发表于 2011-11-03 11:53 |只看该作者
本帖最后由 llzqq 于 2011-11-03 11:55 编辑

主从同步的过程是这样的:

1. 主DNS发现ZONE中的串行号增大。
2. 主DNS通知从DNS来同步。
3. 从DNS接到通知后同步数据。

4. 从DNS也会定期主动到主DNS上验证自己的数据是否是最新的。

理解了这个过程,主从同步就容易了。

论坛徽章:
0
7 [报告]
发表于 2011-11-16 17:21 |只看该作者
本帖最后由 dgvri 于 2011-11-16 17:41 编辑

1,如果你的主从配置没问题的话,应该是你在主上改了记录后,增大序列号,然后reload主系统,它会从机来取,不需要手动。
2,从机的的更新时间你的ZONE文件中的 refresh,有关。

建议你看看置顶的文档。


server named restar等于重启了named
/usr/sbin/rndc reload 只reload配置文件,不重启主进程。

/usr/sbin/rndc --help 看看,bind的主要功能都是这个指令里。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP