]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - man/nss-resolve.xml
test-hostname-util: add assert_se's to make coverity happy
[thirdparty/systemd.git] / man / nss-resolve.xml
index 7d291b83c19908746fb08151ac53e47db1b7ca6c..edd4e9d32eb65c3c82f7343ae91343965142eba3 100644 (file)
@@ -3,6 +3,8 @@
   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
 
 <!--
+  SPDX-License-Identifier: LGPL-2.1+
+
   This file is part of systemd.
 
   Copyright 2011 Lennart Poettering
@@ -22,7 +24,7 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 -->
 
-<refentry id="nss-resolve" conditional='ENABLE_RESOLVED'>
+<refentry id="nss-resolve" conditional='ENABLE_RESOLVE'>
 
   <refentryinfo>
     <title>nss-resolve</title>
   <refsect1>
     <title>Description</title>
 
-    <para><command>nss-resolve</command> is a plugin module for the
-    GNU Name Service Switch (NSS) functionality of the GNU C Library
-    (<command>glibc</command>) enabling it to resolve host names via
-    the
-    <citerefentry><refentrytitle>systemd-resolved</refentrytitle><manvolnum>8</manvolnum></citerefentry>
-    local network name resolution service.</para>
-
-    <para>To activate the NSS module, <literal>resolve</literal>
-    has to be added to the line starting with
-    <literal>hosts:</literal> in
-    <filename>/etc/nsswitch.conf</filename>.</para>
-
-    <para>It is recommended to place <literal>resolve</literal> early
-    in the <filename>nsswitch.conf</filename> line (but after the
-    <literal>files</literal> entry), replacing the
-    <literal>dns</literal> entry if it exists, to ensure DNS queries
+    <para><command>nss-resolve</command> is a plug-in module for the GNU Name Service Switch (NSS) functionality of the
+    GNU C Library (<command>glibc</command>) enabling it to resolve host names via the
+    <citerefentry><refentrytitle>systemd-resolved</refentrytitle><manvolnum>8</manvolnum></citerefentry> local network
+    name resolution service. It replaces the <command>nss-dns</command> plug-in module that traditionally resolves
+    hostnames via DNS.</para>
+
+    <para>To activate the NSS module, add <literal>resolve</literal> to the line starting with
+    <literal>hosts:</literal> in <filename>/etc/nsswitch.conf</filename>. Specifically, it is recommended to place
+    <literal>resolve</literal> early in <filename>/etc/nsswitch.conf</filename>'s <literal>hosts:</literal> line (but
+    after the <literal>files</literal> or <literal>mymachines</literal> entries), right before the
+    <literal>dns</literal> entry if it exists, followed by <literal>[!UNAVAIL=return]</literal>, to ensure DNS queries
     are always routed via
-    <citerefentry><refentrytitle>systemd-resolved</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
+    <citerefentry><refentrytitle>systemd-resolved</refentrytitle><manvolnum>8</manvolnum></citerefentry> if it is
+    running, but are routed to <command>nss-dns</command> if this service is not available.</para>
+
+    <para>Note that <command>systemd-resolved</command> will synthesize DNS resource
+    records in a few cases, for example for <literal>localhost</literal> and the
+    current hostname, see
+    <citerefentry><refentrytitle>systemd-resolved</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+    for the full list. This duplicates the functionality of
+    <citerefentry><refentrytitle>nss-myhostname</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+    but it is still recommended (see examples below) to keep
+    <command>nss-myhostname</command> configured in
+    <filename>/etc/nsswitch.conf</filename>, to keep those names resolveable if
+    <command>systemd-resolved</command> is not running.</para>
   </refsect1>
 
   <refsect1>
     <title>Example</title>
 
-    <para>Here's an example <filename>/etc/nsswitch.conf</filename>
-    file, that enables <command>resolve</command> correctly:</para>
+    <para>Here is an example <filename>/etc/nsswitch.conf</filename> file that enables <command>nss-resolve</command>
+    correctly:</para>
 
-<programlisting>passwd:         compat mymachines
-group:          compat mymachines
+<programlisting>passwd:         compat mymachines systemd
+group:          compat mymachines systemd
 shadow:         compat
 
-hosts:          files <command>resolve</command> mymachines myhostname
+hosts:          files mymachines <command>resolve [!UNAVAIL=return]</command> dns myhostname
 networks:       files
 
 protocols:      db files
@@ -95,13 +104,6 @@ ethers:         db files
 rpc:            db files
 
 netgroup:       nis</programlisting>
-
-    <para>Note that <command>nss-resolve</command> will chain-load
-    <command>nss-dns</command> if
-    <filename>systemd-resolved.service</filename> is not running,
-    ensuring that basic DNS resolution continues to work if the
-    service is down.</para>
-
   </refsect1>
 
   <refsect1>
@@ -109,8 +111,9 @@ netgroup:       nis</programlisting>
     <para>
       <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
       <citerefentry><refentrytitle>systemd-resolved</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
-      <citerefentry><refentrytitle>nss-mymachines</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+      <citerefentry><refentrytitle>nss-systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
       <citerefentry><refentrytitle>nss-myhostname</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+      <citerefentry><refentrytitle>nss-mymachines</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
       <citerefentry project='man-pages'><refentrytitle>nsswitch.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
     </para>
   </refsect1>