LAN 的 Bind9 超时,服务器正在监听端口 53

LAN 的 Bind9 超时,服务器正在监听端口 53

我在 Ubuntu Xenial 上使用 Bind9 时遇到了非常奇怪的情况。服务器正在监听端口 53(portqry已从尝试将其用作本地 DNS 服务器的 Windows 机器上进行测试),但它在以下请求上超时:

> dig @192.168.1.6 YYY +search

; <<>> DiG 9.11.0-P3 <<>> @192.168.1.6 YYY +search
; (1 server found)
;; global options: +cmd
;; connection timed out; no servers could be reached

在 Windows 上搜索域设置正确(ISC DHCP 确保这一点)。但是,正如我所说,portqry探测端口 53 表明它正在监听。

> portqry -n 192.168.1.6 -o 53

Querying target system called:

192.168.1.6

Attempting to resolve IP address to a name...

Failed to resolve IP address to name

querying...

TCP port 53 (domain service): LISTENING

奇怪的是,服务器响应本地主机上的查询(来自服务器本身):

; <<>> DiG 9.10.3-P4-Ubuntu <<>> @192.168.1.6 YYY +search
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 23454
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 2

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;YYY.mydomain.tld.      IN      A

;; ANSWER SECTION:
YYY.mydomain.tld. 3600  IN      A       192.168.1.11

;; AUTHORITY SECTION:
mydomain.tld.    3600    IN      NS      DNS-SERVER.mydomain.tld.

;; ADDITIONAL SECTION:
DNS-SERVER.mydomain.tld. 3600  IN      A       192.168.1.6

;; Query time: 0 msec
;; SERVER: 192.168.1.6#53(192.168.1.6)
;; WHEN: Thu Feb 23 03:59:37 CST 2017
;; MSG SIZE  rcvd: 104

Netstat 声称named正在监听所有常用端口/地址:

~# netstat -tanpl | grep named
tcp        0      0 10.8.0.1:53             0.0.0.0:*               LISTEN      4074/named
tcp        0      0 192.168.1.6:53          0.0.0.0:*               LISTEN      4074/named
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      4074/named
tcp        0      0 127.0.0.1:953           0.0.0.0:*               LISTEN      4074/named

有任何想法吗?

编辑:根据大家的要求,这里是/etc/bind/named.conf.options

options {
    directory "/var/cache/bind";

    // If there is a firewall between you and nameservers you want
    // to talk to, you might need to uncomment the query-source
    // directive below.  Previous versions of BIND always asked
    // questions using port 53, but BIND 8.1 and later use an unprivileged
    // port by default.

    // query-source address * port 53;

    // If your ISP provided one or more IP addresses for stable
    // nameservers, you probably want to use them as forwarders.
    // Uncomment the following block, and insert the addresses replacing
    // the all-0's placeholder.

    // forwarders {
    //      0.0.0.0;
    // };
    query-source address * port 53;
    auth-nxdomain no;    # conform to RFC1035
    listen-on-v6 { none; };
    forwarders {
            8.8.8.8;
            8.8.4.4;
            };
    forward first;
};

答案1

好的,感谢杰斯科特用石头砸为了方便以后使用,如果其他人需要解决类似情况,可以参考以下建议步骤:

  1. 确保已打开 TCP 上的 53 端口和 UDP。端口扫描 UDP 端口比较棘手,因此一定要确保 UDP 53 确实可以通过。
  2. 您应该allow-query { any; };在命名配置文件的全局部分中拥有(/etc/bind/named.conf.options在 Debian/Ubuntu 上)
  3. systemd检查您可以使用的机器上的配置语法,systemctl status bind9并根据绑定日志的设置方式,journalctl -xe -u bind9查看守护程序是否启动。
  4. 从绑定主机和多台机器测试解析。

相关内容