免费注册 查看新帖 |

Chinaunix

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

[DNS] 初学dns,请教关于子网查询notify更新的问题,谢谢 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-04-08 12:59 |只看该作者 |倒序浏览
初学DNS架设,遇到两个问题搞不明白,请各位指点一下,小弟十分感激

系统使用的lfs,安装的bind-9.3.1
vmware中安装的RHEL4 bind-9.2.4-2,使用host-only方式与主机联网,两台机器都没有开防火墙。

在设定子网授权时遇到了问题,我想对blue.org解析,其他的转发到ISP提供的dns server上,rhel.blue.org授权给172.16.245.101来管理.
named对于这部分是这样设置的:
named.conf :

  1. options {
  2.         directory "/var/named";
  3.         pid-file "/var/run/named/named.pid";

  4.         forwarders {
  5.           192.168.200.99;
  6.           192.168.200.100;
  7. };
  8. };

  9. zone "blue.org" {
  10.            type master;
  11.            file "named.blue.org";
  12.   
  13. };

复制代码


/var/named/named.blue.org:



  1. $TTL    1D
  2. @       IN     SOA  blue.org. root.blue.org. (
  3.               2005040801
  4.               1D
  5.               1H
  6.               1W
  7.               1D
  8. )

  9. @       IN     NS      blue.org.
  10. @       IN     A       127.0.0.1
  11. rhel    IN     NS      dns.rhel.blue.org.
  12. dns.rhel  IN   A       172.16.245.101
  13. win2k   IN     A       172.16.245.100

复制代码

这样我的win2k可以正常解析了,但dns.rhel不能解析

然后在172.16.245.101中设定了rhel.blue.org:

  1. zone "rhel.blue.org" {
  2.          type master;
  3.          file "named.rhel.blue.org";
  4. };

复制代码



named.rhel.blue.org:


  1. $TTL    1D
  2. @   IN SOA  dns.rhel.blue.org. root.dns.rhel.blue.org. (
  3.               2005040801
  4.               1D
  5.               1H
  6.               1W
  7.               1D
  8. )

  9. @       IN     NS      dns.rhel.blue.org.
  10. @       IN     A       172.16.245.101
  11. silence  IN    A       172.16.245.50

复制代码


在172.16.245.101中测试可以解析silence,但在主机上无法解析,看过精华贴后,知道应该是因为主机将rhel.blue.org的解析转发到192.168.200.99/100那两个上去了。

在zone "blue.org"中加了 forwarders {};
禁止转发,或者去掉到192.168.200.99/100的转发,直接向root查询,这样就可以正常解析rhel.blue.org了,不明白这里是怎样查询的,为什么forward没有查询到而不去查询自己的subzone呢??

另外172.16.245.101做为slave同步更新blue.orgsh时,当master修改了named.blue.org,增大了Serial,重启named服务
slave却不能同步更新,但是到了Refresh时间,slave就会自动更新,在zone "blue.org"里加入
notify yes
also-notify {172.16.245.101;};
还是不行,怀疑slave 在Retry,降低Retry时间也不可以。

主机的日志:

  1. Apr  8 12:58:04 localhost named[3174]: starting BIND 9.3.1 -u named -c /etc/named.conf
  2. Apr  8 12:58:04 localhost named[3174]: loading configuration from '/etc/named.conf'
  3. Apr  8 12:58:05 localhost named[3174]: no IPv6 interfaces found
  4. Apr  8 12:58:05 localhost named[3174]: listening on IPv4 interface eth0, 10.70.54.31#53
  5. Apr  8 12:58:05 localhost named[3174]: listening on IPv4 interface lo, 127.0.0.1#53
  6. Apr  8 12:58:05 localhost named[3174]: listening on IPv4 interface vmnet8, 172.16.249.1#53
  7. Apr  8 12:58:05 localhost named[3174]: listening on IPv4 interface vmnet1, 172.16.245.1#53
  8. Apr  8 12:58:05 localhost named[3174]: command channel listening on 127.0.0.1#953
  9. Apr  8 12:58:05 localhost named[3174]: zone 0.0.127.in-addr.arpa/IN: loaded serial 2005040701
  10. Apr  8 12:58:05 localhost named[3174]: zone 245.16.172.in-addr.arpa/IN: loaded serial 2005040701
  11. Apr  8 12:58:05 localhost named[3174]: zone localhost/IN: loaded serial 2005040701
  12. Apr  8 12:58:05 localhost named[3174]: zone blue.org/IN: loaded serial 2005040803
  13. Apr  8 12:58:05 localhost named[3174]: running
  14. Apr  8 12:58:05 localhost named[3174]: zone blue.org/IN: sending notifies (serial 2005040803)
复制代码

的确是发出了notify,172.16.245.101里的日志也的确收到了
notify,但就是没有transfer of 'blue.org/IN' from .....
到了Refresh就会更新。

不知道问题出在哪里了, 请各位大侠指教

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
2 [报告]
发表于 2005-04-08 13:54 |只看该作者

初学dns,请教关于子网查询notify更新的问题,谢谢

在 master 的 NS record 請確定包含所有的 server.

论坛徽章:
0
3 [报告]
发表于 2005-04-08 16:04 |只看该作者

初学dns,请教关于子网查询notify更新的问题,谢谢

谢谢回帖

您所说的NS record中包括所有Server 是不是就是说
要在named.blue.org 中写上所有授权Server地址呢?

  1. @       IN     NS      blue.org.
  2. @       IN     A       127.0.0.1
  3. rhel    IN     NS      dns.rhel.blue.org.
  4. dns.rhel  IN   A       172.16.245.101
  5. win2k   IN     A       172.16.245.100
复制代码


rhel    IN     NS      dns.rhel.blue.org.
dns.rhel  IN   A       172.16.245.101

就是这两行吗?
我只授权了rhel.blue.org这一个subzone给172.16.245.101
还少写了什么吗?

另外notify有什么限制吗?
我发现如果不在 zone "blue.org" {};里加入
notify yes ; also-notify {172.16.245.101};
重启named服务,master/slave日志中都没有
08-Apr-2005 15:53:28.878 zone blue.org/IN: sending notifies (serial 2005040813)

只有加入了master/slave才只有上面一行,并不传输数据。

master和slave 不是一个网段的,不知道有没有关系。

谢谢

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
4 [报告]
发表于 2005-04-08 22:34 |只看该作者

初学dns,请教关于子网查询notify更新的问题,谢谢

全寫, 含 master 與 slave
@ IN NS xxxxx.xxx.xxxx.
@ IN NS xxxxx.xxx.xxxx.

论坛徽章:
0
5 [报告]
发表于 2005-04-09 16:44 |只看该作者

初学dns,请教关于子网查询notify更新的问题,谢谢

我又试着在vmware里使用桥接,设定slave(10.70.54.33)和master(10.70.54.31)在同一个网段,现在更改master后,slave可以立刻同步更新了,不过需要在master里加入also-notify {10.70.54.33;}; 才可以。
不明白为什么在不同网段不能正常传输,同一个网段就可以了
我想问题就是您说的没将slave的ns写到master的ns记录上.

小弟比较笨,这里理解不好,下面是我的配置文件,希望等您有时间看看哪里不对,十分感谢.


  1. 10.70.54.31 named.conf:

  2. include "/etc/rndc.key";
  3. options {
  4.        directory "/var/named";
  5.        pid-file "/var/run/named/named.pid";
  6. };

  7. zone "." {
  8.          type hint;
  9.          file "named.root";
  10. };

  11. zone "localhost" {
  12.         type master;
  13.         file "named.localhost";
  14. };

  15. zone "0.0.127.in-addr.arpa" {
  16.         type master;
  17.         file "named.127.0.0";
  18. };

  19. zone "blue.org" {
  20.         type master;
  21.         file "named.blue.org";
  22.         //notify yes;
  23.         //also-notify {10.70.54.33;};
  24. };
复制代码


  1. 10.70.54.31  named.blue.org:

  2. $TTL  1D
  3. @     IN    SOA  lfs.blue.org.  root.lfs.blue.org. (
  4.               2005040901
  5.               2H
  6.               30
  7.               1W
  8.               1D
  9. )
  10. @     IN      NS     lfs.blue.org.
  11.       IN      MX 10  lfs.blue.org.
  12.       IN      A      10.70.54.31
  13. lfs   IN      A      10.70.54.31
  14. rhel  IN      NS     rhce.rhel.blue.org.
  15. rhce.rhel IN  A      10.70.54.33
复制代码


  1. 10.70.54.33 named.conf :

  2. options {
  3.         directory "/var/named";
  4.         dump-file "/var/named/data/cache_dump.db";
  5.         statistics-file "/var/named/data/named_stats.txt";
  6.         forward first;
  7.         forwarders {
  8.             10.70.54.31;
  9. };

  10. };
  11. include "/etc/rndc.key";
  12. zone "localhost" {
  13.         type master;
  14.         file "named.localhost";
  15. };
  16. zone "rhel.blue.org" {
  17.          type master;
  18.          file "named.rhel.blue.org";
  19. };

  20. zone "blue.org" {
  21.           type slave;
  22.           file "named.blue.org";
  23.           masters {
  24.            10.70.54.31;
  25. };
  26. };
复制代码


  1. 10.70.54.33 named.rhel.blue.org :

  2. $TTL    1D
  3. @       IN    SOA    rhce.rhel.blue.org. root.rhce.rhel.blue.org. (
  4.               2005040901
  5.               1D
  6.               1H
  7.               1W
  8.               1D
  9. )

  10. @        IN    NS     rhce.rhel.blue.org.
  11. rhce     IN    A       10.70.54.33
  12. www      IN    CNAME  rhce.rhel.blue.org.
复制代码


  1. $TTL   1D
  2. @      IN        SOA    localhost. root.localhost. (
  3.                  2005040901
  4.                  1D
  5.                  1H
  6.                  1W
  7.                  1D

  8. )

  9. @       IN       NS     localhost.
  10. @       IN       A      127.0.0.1
复制代码



  1. $TTL    1D
  2. @       IN        SOA     localhost. root.localhost. (
  3.                   2005040901
  4.                   1D
  5.                   1H
  6.                   1W
  7.                   1D
  8. )

  9. @       IN        NS     localhost.
  10. @       IN        PTR    localhost.

复制代码



  1. 没有 also-notify 启动日志:
  2. Apr  9 16:47:30 localhost named[3651]: starting BIND 9.3.1 -u named -c /etc/named.conf
  3. Apr  9 16:47:30 localhost named[3651]: loading configuration from '/etc/named.conf'
  4. Apr  9 16:47:30 localhost named[3651]: no IPv6 interfaces found
  5. Apr  9 16:47:30 localhost named[3651]: listening on IPv4 interface eth0, 10.70.54.31#53
  6. Apr  9 16:47:30 localhost named[3651]: listening on IPv4 interface lo, 127.0.0.1#53
  7. Apr  9 16:47:30 localhost named[3651]: listening on IPv4 interface vmnet1, 172.16.245.1#53
  8. Apr  9 16:47:30 localhost named[3651]: listening on IPv4 interface vmnet8, 172.16.249.1#53
  9. Apr  9 16:47:30 localhost named[3651]: command channel listening on 127.0.0.1#953
  10. Apr  9 16:47:30 localhost named[3651]: zone 0.0.127.in-addr.arpa/IN: loaded serial 2005040901
  11. Apr  9 16:47:30 localhost named[3651]: zone localhost/IN: loaded serial 2005040901
  12. Apr  9 16:47:30 localhost named[3651]: zone blue.org/IN: loaded serial 2005040902
  13. Apr  9 16:47:30 localhost named[3651]: running

复制代码



  1. 加入 also-notify日志:
  2. Apr  9 16:48:42 localhost named[3672]: starting BIND 9.3.1 -u named -c /etc/named.conf
  3. Apr  9 16:48:42 localhost named[3672]: loading configuration from '/etc/named.conf'
  4. Apr  9 16:48:42 localhost named[3672]: no IPv6 interfaces found
  5. Apr  9 16:48:42 localhost named[3672]: listening on IPv4 interface eth0, 10.70.54.31#53
  6. Apr  9 16:48:42 localhost named[3672]: listening on IPv4 interface lo, 127.0.0.1#53
  7. Apr  9 16:48:42 localhost named[3672]: listening on IPv4 interface vmnet1, 172.16.245.1#53
  8. Apr  9 16:48:42 localhost named[3672]: listening on IPv4 interface vmnet8, 172.16.249.1#53
  9. Apr  9 16:48:42 localhost named[3672]: command channel listening on 127.0.0.1#953
  10. Apr  9 16:48:42 localhost named[3672]: zone 0.0.127.in-addr.arpa/IN: loaded serial 2005040901
  11. Apr  9 16:48:42 localhost named[3672]: zone localhost/IN: loaded serial 2005040901
  12. Apr  9 16:48:42 localhost named[3672]: zone blue.org/IN: loaded serial 2005040902
  13. Apr  9 16:48:42 localhost named[3672]: running
  14. Apr  9 16:48:42 localhost named[3672]: zone blue.org/IN: sending notifies (serial 2005040902)
  15. Apr  9 16:48:42 localhost named[3672]: client 10.70.54.33#1030: transfer of 'blue.org/IN': AXFR-style IXFR started
  16. Apr  9 16:48:42 localhost named[3672]: client 10.70.54.33#1030: transfer of 'blue.org/IN': AXFR-style IXFR ended

复制代码


谢谢

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
6 [报告]
发表于 2005-04-09 21:56 |只看该作者

初学dns,请教关于子网查询notify更新的问题,谢谢

基本上, 只要 master 有更新的話, 在 restart 時, 就會向所有 NS record 指定的主機(除自己外)送 notify.
若在 named.conf 裡, 還有 also-notify 的話, 則除 NS 外還會另行通知清單所列的主機.

順便, 趁這個機會, 再說一下 SOA 那 5 組數字的前 4 組的功能好了.

serial:
此值為 10 進位數值, 不大於 2 的 32 次方, 若超過, 則取餘數.
當 slave 收到 master 送來的 notify 之後, 會向 named.conf 所列的 masters 送除 SOA 查詢, 以比對雙方的 serial 值, 若是 master 那邊比 slave 這邊要大(或 master 設為 0 ), 則進行 AXFER 查詢, 也就是所謂的 zone transfer, 於是 db 就會跟著同步.

refresh:
此值為秒數, 需大於 retry 值, 每秒遞減 1 .
當 master 在更新 db 時所送出的 notify 意外不能到達 slave. 那 slave 的 db 將不會獲得同步(參考前述). 為避免此種情形, slave 會在 refresh 值遞減致 0 值時, 將會對 master 送出 SOA 查詢, 以便進行 db 同步(參考前述). 一旦 db 同步後, refresh 將重新倒數. 但是若 refresh 所引發的 SOA 查詢沒有結果, 則進行 retry(下述) 計時, 而放棄 refresh 採值.

retry:
此值為秒數, 需小於 refresh 值, 一旦進入倒數每秒遞減 1 .
這是當前述的 refresh 不成功時, 所進行的更短時間的 SOA 查詢計時. 目的是加速 db 同步的間隔時間.

expire:
此值為秒數, 需大於 refresh + retry 的和, 且建議大於 7 天, 一旦 db 更新後就每秒遞減 1 的倒數.
若 retry 一直不能成功, 那當 expire 時間到達時, 將放棄 db 同步, 同時將所有 record 標識為失效.

至於最後的 ttl , 請參考另文:
http://bbs.chinaunix.net/forum/viewtopic.php?p=1679564&highlight=ttl
大意如下:
"最後的 min ttl 則是當 recorad 沒設 ttl、且 db 也沒設 $TTL 時參考。"

论坛徽章:
0
7 [报告]
发表于 2011-03-24 00:26 |只看该作者
zone "blue.org" {

          type slave;

          file "named.blue.org";

          masters {

           10.70.54.31;

应该是:
zone "blue.org" {

          type slave;

          file "slaves/named.blue.org";

          masters {

           10.70.54.31;
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP