大网数据广告活动
服务器运维问答

Instability of DNS with bind9

· 52CE 我爱测

I've setup a DNS with bind9 (9.9.5) on Ubuntu 14.04/trusty (kernel 4.4.0-59) for my local network. It is working, but sometimes it fails to find an IP of a host (e.g. ping says: ping: unknown host aypi1.bxlab ). My setup is as fo…

问题原文

原帖链接 · Akihiko · CC BY-SA 3.0

I've setup a DNS with bind9 (9.9.5) on Ubuntu 14.04/trusty (kernel 4.4.0-59) for my local network. It is working, but sometimes it fails to find an IP of a host (e.g. ping says: ping: unknown host aypi1.bxlab).

My setup is as follows.

/etc/bind/named.conf.options:

options {
        directory "/var/cache/bind";
        dnssec-validation auto;

        auth-nxdomain no;
        listen-on-v6 { none; };

        allow-query {
          127.0.0.1;
          192.168.0.0/24;
        };
};

/etc/bind/named.conf.local:

zone "bxlab" IN {
  type master;
  file "/etc/bind/db.intra";
};

zone "0.168.192.in-addr.arpa" IN {
  type master;
  file "/etc/bind/db.0.168.192";
};

/etc/bind/db.intra:

$TTL 1D    ;

@ IN SOA bxlab. root.bxlab (
  2011102401 ; Serial
  3H         ; Refresh
  1H         ; Retry
  1W         ; Expire
  1D )       ; Minimum

                  IN NS  aypi1.bxlab. ;
aypi0              IN A   192.168.0.10 ;
aypi1              IN A   192.168.0.11 ;
aypi2              IN A   192.168.0.12 ;

ns                 IN CNAME aypi1  ;

/etc/bind/db.0.168.192:

$TTL 1D    ;

@ IN SOA ns.bxlab.  root.ns.bxlab (
  2011102301 ; Serial
  3H         ; Refresh
  1H         ; Retry
  1W         ; Expire
  1D )       ; Minimum

    IN NS  ns.bxlab.
    IN PTR bxlab.
    IN A 255.255.255.0
10  IN PTR aypi0        ;
11  IN PTR aypi1        ;
12  IN PTR aypi2        ;

I also changed my router configurations as follows:

Primary DNS: 192.168.0.11
Secondary: xxx.xxx.xxx.xxx  (DNS IP Provided by ISP)

The trouble is:

  1. After restarting bind9, nslookup worked with aypi1.bxlab.
  2. After 30 min (?), ping aypi1.bxlab returned ping: unknown host aypi1.bxlab.
  3. But waiting some seconds (maybe 6 sec?), ping became to work.
  4. 2 and 3 are repeated.

Do anybody have an idea to figure this out?

Many thanks!

已采纳解答

原帖链接 · Akihiko · CC BY-SA 3.0

As @pete pointed out in the comments above, the issue was the router configuration.

I modified the router DNS setting as:

Primary DNS: 192.168.0.11
Secondary: 0.0.0.0

Then I modified /etc/bind/named.conf.options as:

options {
        [...]

        forwarders {xx.xx.xx.xx; xx.xx.xx.yy; xx.xx.xx.zz;};
        forward first;
};

The IPs in forwarders are DNS from ISP.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-01-23)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。