首页 > 解决方案 > Bind9:限制子网查询

问题描述

我有一台带有 WiFi 热点的 linux 机器,在 172.30.108.0/24 网络中分配 IP。

我已经安装了绑定 9。我的named.conf 只包含“include”/etc/bind/named.conf.local“;”,其他所有内容都被禁用。

我的 named.conf.local 有:

options {
        listen-on port 53 { 0.0.0.0; };
        listen-on-v6 port 53 { ::1; };
        directory       "/var/cache/bind";
        allow-query     { localhost; };
        recursion yes;
        querylog yes;
};



acl clients {
   172.30.108.0/24;
};

view "internal-view" {
  match-clients { internal; };
  allow-query { internal; };
  allow-query-cache { internal; };

  zone "limit.com." {
     type master;
     file "/etc/bind/db.limit.com";
  };

  # Mapping: Everything else to 127.0.0.1 
  zone "." {
    type master;
    file "/etc/bind/db.mapping";
  };

};

view "external-view" {
  match-clients { any; };
  allow-query { any; };
  allow-recursion { any; };
  allow-query-cache { any; };

  zone "wiincon.de." {
     type master;
     file "/etc/bind/db.limit.com";
  };

  include "/etc/bind/named.conf.default-zones";
};

我的 db.limit.com:

; BIND reverse data file for broadcast zone
;
$TTL    180
@       IN      SOA     localhost. root.localhost. (
                              5         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      localhost.

@       IN      A       192.168.5.5
www     IN      A       192.168.5.5

最后是我的 db.mapping:

; BIND reverse data file for broadcast zone
;
$TTL    3600
@       IN      SOA     localhost. root.localhost. (
                              4         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@       IN      NS      localhost.

*       IN      A       127.0.0.1

我现在的问题是:172.30.108.0/24 中的客户可以查询任何内容,但 www.limit.com

实际上:来自 172.30.108.0/24 的客户端应该能够解析 limit.com 和 www.limit.com,其他一切都应该以 127.0.0.1 响应。

当做一个 nslookup 我得到

非权威答案:***找不到limit.com:没有答案

我确定我在这里遗漏了一些非常明显的东西。非常感谢任何帮助。

标签: dnsbind

解决方案


找到了。问题是“SYSTEM”本身有 8.8.8.8 作为名称服务器,因此绕过了本地的所有内容。


推荐阅读