如何用BIND替换mdns4_minimal?

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

hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4

您能否解释一下mdns4_minimalmdns4含义以及如何使系统使用本地BIND实例来解析DNS查询?

是的,我知道如何开始/停止BIND。

 systemctl enable bind9 systemctl start/stop bind9. 

  • 提供了mDNS或多播DNS服务Avahi / Bonjour守护程序,它允许小型网络计算机使用名称,甚至不存在中央DNS。 它默认使用.local域。

  • 如果您没有将.local用于DNS服务器,请在mDNS nsswitch.conf之后设置DNS

     hosts: files mdns4_minimal dns [NOTFOUND=return] mdns4 

    否则.local由您的DNS服务器使用(不用于mdns服务)

     hosts: files dns [NOTFOUND=return] mdns4_minimal mdns4 
  • mdn4_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 

    文档

    编译并安装nss-mdns你会在/lib找到六个新的NSS模块:

    • 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_mdns4.so.2libnss_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的版本大致相同。 但是,它们在某种程度上有所不同。 最小版本将始终拒绝解析不以.local结尾的主机名或不在169.254.xx范围内的169.254.xx ( IPV4LL / APIPA / RFC3927使用的范围。)组合_minimal和普通NSS模块允许我们使mDNS对Zeroconf主机名和地址具有权威性(因此在始终失败的请求的DNS服务器上不会产生额外负担)并将其用作其他所有内容的后备。

  • IPv6支持

    • filesdns NSS模块,除IPv4之外都支持解析IPv6。
    • 但是, mdns4mdns4_minimal仅适用于IPv4。

      mdns6mdns6_minimal相同内容仅适用于IPv6。

      mdnsmdns_minimal支持IPv4和IPv6,但如果网络中只部署了一个IP版本,则应避免使用它。 因为它将尝试解析为IPv6然后回退到IPv4,这可能会产生额外的延迟。

      顺便说一句,目前Avahi的默认设置是IPv4,它是一种分散的服务。 所以要配合IPv6,alls机器也应该在nsswitchavahi重新配置使用IPv6。

  • 还有其他[]类似于[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. 

相关问题:

  • 为什么host命令不能解析/ etc / hosts中的条目?