如何用 BIND 替换 mdns4_minimal?

Bul*_* M. 11 server networking dns bind 16.04

拥有 Ubuntu 16.04 LTS 版本。根据任务应该安装 BIND 作为 DNS 服务器。我在 nsswitch.conf 中注意到:

hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4

能否请您解释一下什么mdns4_minimalmdns4意味着,以及如何使系统使用本地绑定实例解析DNS查询?

是的,我知道如何启动/停止 BIND。

systemctl enable bind9
systemctl start/stop bind9.
Run Code Online (Sandbox Code Playgroud)

use*_*.dz 38

mDNS 或多播 DNS 服务

它由Avahi/Bonjour守护进程提供,即使没有中央 DNS 存在,它也允许小型网络计算机使用名称。它默认使用.local域。

mdns4_minimal 和 mdns4 有什么区别?

为了回答您,最好让我知道如何收集此类信息并自己学习:)(##用于评论以说明其下方命令的目标)

## Update "locate" database
~$ sudo updatedb
## Search for file with "mdns4_minimal" in its name
~$ locate mdns4_minimal
/lib/x86_64-linux-gnu/libnss_mdns4_minimal.so.2

## Look for which package installs that file
~$ dpkg -S /lib/x86_64-linux-gnu/libnss_mdns4_minimal.so.2
libnss-mdns:amd64: /lib/x86_64-linux-gnu/libnss_mdns4_minimal.so.2

## List all files from same package
~$ dpkg -L libnss-mdns:amd64
/.
/usr
/usr/share
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/libnss-mdns
/usr/share/doc
/usr/share/doc/libnss-mdns
/usr/share/doc/libnss-mdns/copyright
/usr/share/doc/libnss-mdns/README.html
/usr/share/doc/libnss-mdns/README.Debian
/usr/share/doc/libnss-mdns/style.css
/usr/share/doc/libnss-mdns/changelog.Debian.gz
/lib
/lib/x86_64-linux-gnu
/lib/x86_64-linux-gnu/libnss_mdns4.so.2
/lib/x86_64-linux-gnu/libnss_mdns_minimal.so.2
/lib/x86_64-linux-gnu/libnss_mdns.so.2
/lib/x86_64-linux-gnu/libnss_mdns4_minimal.so.2
/lib/x86_64-linux-gnu/libnss_mdns6.so.2
/lib/x86_64-linux-gnu/libnss_mdns6_minimal.so.2

## "README.html" looks the only documentation there, we open it
~$ xdg-open /usr/share/doc/libnss-mdns/README.html
Run Code Online (Sandbox Code Playgroud)

文档

编译和安装后,nss-mdns您将在以下位置找到六个新的 NSS 模块/lib

  • libnss_mdns.so.2
  • libnss_mdns4.so.2
  • libnss_mdns6.so.2
  • libnss_mdns_minimal.so.2
  • libnss_mdns4_minimal.so.2
  • libnss_mdns6_minimal.so.2


libnss_mdns.so.2解析 IPv6 和 IPv4 地址,libnss_mdns4.so.2仅解析IPv4 地址和libnss_mdns6.so.2仅解析 IPv6 地址。由于大多数 mDNS 响应者仅通过 mDNS 注册本地 IPv4 地址,因此大多数人希望libnss_mdns4.so.2独占使用 。在这种情况下使用libnss_mdns.so.2libnss_mdns6.so.2会在解析主机时导致长时间超时,因为大多数现代 Unix/Linux 应用程序首先检查 IPv6 地址,然后查找 IPv4。

libnss_mdns{4,6,}_minimal.so(0.8 版中的新功能)与没有_minimal. 但是,它们在某一方面有所不同。最小版本将始终拒绝解析不以 in 结尾的主机名.local或不在范围内的地址 169.254.x.xIPV4LL/APIPA/RFC3927使用的范围 。)结合使用_minimal和普通 NSS 模块允许我们使 mDNS 具有权威性用于 Zeroconf 主机名和地址(因此不会在请求总是失败的 DNS 服务器上造成额外负担)并将其用作其他所有内容的后备。

IPv6 支持

  • files& dnsNSS 模块,除了 IPv4 之外,都支持解析 IPv6。
  • 但是,mdns4&mdns4_minimal仅适用于 IPv4。

    mdns6&相同,mdns6_minimal仅适用于 IPv6。

    mdns& 同时mdns_minimal支持 IPv4 和 IPv6,但如果网络中只部署了一个 IP 版本,则应避免使用它。因为它会尝试解析为 IPv6,然后回退到 IPv4,这会造成额外的延迟。

    顺便说一句,Avahi 目前的默认设置是 IPv4,它是一个去中心化的服务。于是去了IPv6,承滴盘机应在重新使用IPv6nsswitchavahi太。

有没有其他[]类似的[NOTFOUND=return]

是的,正如我们所看到的 man nsswitch.conf

   An action may also be specified following a service specification.   The  action  modifies
   the  behavior  following  a  result obtained from the preceding data source.  Action items
   take the general form:

       [STATUS=ACTION]
       [!STATUS=ACTION]

   where

       STATUS => success | notfound | unavail | tryagain
       ACTION => return | continue

   The ! negates the test, matching all possible results except the one specified.  The  case
   of the keywords is not significant.

   The  STATUS  value is matched against the result of the lookup function called by the pre?
   ceding service specification, and can be one of:

       success     No error occurred and the requested entry is returned.  The default action
                   for this condition is "return".

       notfound    The  lookup succeeded, but the requested entry was not found.  The default
                   action for this condition is "continue".

       unavail     The service is permanently unavailable.  This can  mean  either  that  the
                   required file cannot be read, or, for network services, that the server is
                   not available or does not allow queries.  The default action for this con?
                   dition is "continue".

       tryagain    The  service is temporarily unavailable.  This could mean a file is locked
                   or a server currently cannot accept more connections.  The default  action
                   for this condition is "continue".

   The ACTION value can be one of:

       return      Return  a result now.  Do not call any further lookup functions.  However,
                   for compatibility reasons, if this is the selected action  for  the  group
                   database and the notfound status, and the configuration file does not con?
                   tain the initgroups line, the next lookup function is always called, with?
                   out affecting the search result.

       continue    Call the next lookup function.
Run Code Online (Sandbox Code Playgroud)

相关问题:

  • mdn4_minimal 和 mdns4 有什么区别?他们看起来一样。 (2认同)
  • 如果处理不会到达它(mdns4),那么在 [NOTFOUND=return] 之后添加 mdns4 的基本原理是什么? (2认同)
  • @布拉特M。它被禁用。他们把它留在那里让用户知道可用的选项。 (2认同)