mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-11 05:17:44 +03:00
man: change recommended order of NSS modules in /etc/nsswitch.conf
So far we recommended placing "nss-mymachines" after "nss-resolve" in the order of preference in /etc/nsswitch.conf. This change reverse this order. Rationale: single-label names are resolved via LLMNR by resolved, which has to time out if no peer by that name exists. By placing "nss-mymachines" first (which always responds immediately) we avoid running into this timeout for most containers. Both modules should return the same data if LLMNR is used by the container anyway. While we are at it, improve the man pages of the three NSS modules in other ways a bit.
This commit is contained in:
parent
45bd485454
commit
9053aaad42
@ -57,12 +57,11 @@
|
|||||||
<refsect1>
|
<refsect1>
|
||||||
<title>Description</title>
|
<title>Description</title>
|
||||||
|
|
||||||
<para><command>nss-myhostname</command> is a plugin for the GNU
|
<para><command>nss-myhostname</command> is a plug-in module for the GNU Name Service Switch (NSS) functionality of
|
||||||
Name Service Switch (NSS) functionality of the GNU C Library
|
the GNU C Library (<command>glibc</command>), primarily providing hostname resolution for the locally configured
|
||||||
(<command>glibc</command>), primarily providing hostname resolution
|
system hostname as returned by
|
||||||
for the locally configured system hostname as returned by
|
<citerefentry><refentrytitle>gethostname</refentrytitle><manvolnum>2</manvolnum></citerefentry>. The precise
|
||||||
<citerefentry><refentrytitle>gethostname</refentrytitle><manvolnum>2</manvolnum></citerefentry>.
|
hostnames resolved by this module are:</para>
|
||||||
The precise hostnames resolved by this module are:</para>
|
|
||||||
|
|
||||||
<itemizedlist>
|
<itemizedlist>
|
||||||
<listitem><para>The local, configured hostname is resolved to
|
<listitem><para>The local, configured hostname is resolved to
|
||||||
@ -80,7 +79,6 @@
|
|||||||
ordered by their metric. This assigns a stable hostname to the
|
ordered by their metric. This assigns a stable hostname to the
|
||||||
current gateway, useful for referencing it independently of the
|
current gateway, useful for referencing it independently of the
|
||||||
current network configuration state.</para></listitem>
|
current network configuration state.</para></listitem>
|
||||||
|
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
|
|
||||||
<para>Various software relies on an always-resolvable local
|
<para>Various software relies on an always-resolvable local
|
||||||
@ -93,29 +91,25 @@
|
|||||||
changing <filename>/etc/hosts</filename> is unnecessary, and on
|
changing <filename>/etc/hosts</filename> is unnecessary, and on
|
||||||
many systems, the file becomes entirely optional.</para>
|
many systems, the file becomes entirely optional.</para>
|
||||||
|
|
||||||
<para>To activate the NSS modules, <literal>myhostname</literal>
|
<para>To activate the NSS modules, add <literal>myhostname</literal> to the line starting with
|
||||||
has to be added to the line starting with
|
<literal>hosts:</literal> in <filename>/etc/nsswitch.conf</filename>.</para>
|
||||||
<literal>hosts:</literal> in
|
|
||||||
<filename>/etc/nsswitch.conf</filename>.</para>
|
|
||||||
|
|
||||||
<para>It is recommended to place <literal>myhostname</literal>
|
<para>It is recommended to place <literal>myhostname</literal> last in the <filename>nsswitch.conf</filename>'
|
||||||
last in the <filename>nsswitch.conf</filename> line to make sure
|
<literal>hosts:</literal> line to make sure that this mapping is only used as fallback, and that any DNS or
|
||||||
that this mapping is only used as fallback, and that any DNS or
|
<filename>/etc/hosts</filename> based mapping takes precedence.</para>
|
||||||
<filename>/etc/hosts</filename> based mapping takes
|
|
||||||
precedence.</para>
|
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
<refsect1>
|
<refsect1>
|
||||||
<title>Example</title>
|
<title>Example</title>
|
||||||
|
|
||||||
<para>Here is an example <filename>/etc/nsswitch.conf</filename>
|
<para>Here is an example <filename>/etc/nsswitch.conf</filename> file that enables
|
||||||
file that enables <command>myhostname</command> correctly:</para>
|
<command>nss-myhostname</command> correctly:</para>
|
||||||
|
|
||||||
<programlisting>passwd: compat mymachines
|
<programlisting>passwd: compat mymachines
|
||||||
group: compat mymachines
|
group: compat mymachines
|
||||||
shadow: compat
|
shadow: compat
|
||||||
|
|
||||||
hosts: files resolve mymachines <command>myhostname</command>
|
hosts: files mymachines resolve <command>myhostname</command>
|
||||||
networks: files
|
networks: files
|
||||||
|
|
||||||
protocols: db files
|
protocols: db files
|
||||||
|
@ -56,42 +56,37 @@
|
|||||||
<refsect1>
|
<refsect1>
|
||||||
<title>Description</title>
|
<title>Description</title>
|
||||||
|
|
||||||
<para><command>nss-mymachines</command> is a plugin for the GNU
|
<para><command>nss-mymachines</command> is a plug-in module for the GNU Name Service Switch (NSS) functionality of
|
||||||
Name Service Switch (NSS) functionality of the GNU C Library
|
the GNU C Library (<command>glibc</command>), providing hostname resolution for the names of containers running
|
||||||
(<command>glibc</command>), providing hostname resolution for
|
locally that are registered with
|
||||||
container names of containers running locally that are registered
|
<citerefentry><refentrytitle>systemd-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>. The
|
||||||
with
|
container names are resolved to the IP addresses of the specific container, ordered by their scope. This
|
||||||
<citerefentry><refentrytitle>systemd-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
|
functionality only applies to containers using network namespacing.</para>
|
||||||
The container names are resolved to the IP addresses of the
|
|
||||||
specific container, ordered by their scope.</para>
|
|
||||||
|
|
||||||
<para>The module also resolves user IDs used by containers to user
|
<para>The module also resolves user and group IDs used by containers to user and group names indicating the
|
||||||
names indicating the container name, and back.</para>
|
container name, and back. This functionality only applies to containers using user namespacing.</para>
|
||||||
|
|
||||||
<para>To activate the NSS modules, <literal>mymachines</literal>
|
<para>To activate the NSS module, add <literal>mymachines</literal> to the lines starting with
|
||||||
has to be added to the lines starting with
|
<literal>hosts:</literal>, <literal>passwd:</literal> and <literal>group:</literal> in
|
||||||
<literal>hosts:</literal>, <literal>passwd:</literal> and
|
|
||||||
<literal>group:</literal> in
|
|
||||||
<filename>/etc/nsswitch.conf</filename>.</para>
|
<filename>/etc/nsswitch.conf</filename>.</para>
|
||||||
|
|
||||||
<para>It is recommended to place <literal>mymachines</literal>
|
<para>It is recommended to place <literal>mymachines</literal> after the <literal>files</literal> or
|
||||||
near the end of the <filename>nsswitch.conf</filename> lines to
|
<literal>compat</literal> entry of the <filename>/etc/nsswitch.conf</filename> lines to make sure that its mappings
|
||||||
make sure that its mappings are only used as fallback, and that any
|
are preferred over other resolvers such as DNS, but so that <filename>/etc/hosts</filename>,
|
||||||
other mappings, such as DNS or <filename>/etc/hosts</filename>
|
<filename>/etc/passwd</filename> and <filename>/etc/group</filename> based mappings take precedence.</para>
|
||||||
based mappings, take precedence.</para>
|
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
<refsect1>
|
<refsect1>
|
||||||
<title>Example</title>
|
<title>Example</title>
|
||||||
|
|
||||||
<para>Here is an example <filename>/etc/nsswitch.conf</filename>
|
<para>Here is an example <filename>/etc/nsswitch.conf</filename> file that enables
|
||||||
file that enables <command>mymachines</command> correctly:</para>
|
<command>nss-mymachines</command> correctly:</para>
|
||||||
|
|
||||||
<programlisting>passwd: compat <command>mymachines</command>
|
<programlisting>passwd: compat <command>mymachines</command>
|
||||||
group: compat <command>mymachines</command>
|
group: compat <command>mymachines</command>
|
||||||
shadow: compat
|
shadow: compat
|
||||||
|
|
||||||
hosts: files resolve <command>mymachines</command> myhostname
|
hosts: files <command>mymachines</command> resolve myhostname
|
||||||
networks: files
|
networks: files
|
||||||
|
|
||||||
protocols: db files
|
protocols: db files
|
||||||
|
@ -56,37 +56,36 @@
|
|||||||
<refsect1>
|
<refsect1>
|
||||||
<title>Description</title>
|
<title>Description</title>
|
||||||
|
|
||||||
<para><command>nss-resolve</command> is a plugin module for the
|
<para><command>nss-resolve</command> is a plug-in module for the GNU Name Service Switch (NSS) functionality of the
|
||||||
GNU Name Service Switch (NSS) functionality of the GNU C Library
|
GNU C Library (<command>glibc</command>) enabling it to resolve host names via the
|
||||||
(<command>glibc</command>) enabling it to resolve host names via
|
<citerefentry><refentrytitle>systemd-resolved</refentrytitle><manvolnum>8</manvolnum></citerefentry> local network
|
||||||
the
|
name resolution service. It replaces the <command>nss-dns</command> plug-in module that traditionally resolves
|
||||||
<citerefentry><refentrytitle>systemd-resolved</refentrytitle><manvolnum>8</manvolnum></citerefentry>
|
hostnames via DNS.</para>
|
||||||
local network name resolution service.</para>
|
|
||||||
|
|
||||||
<para>To activate the NSS module, <literal>resolve</literal>
|
<para>To activate the NSS module, add <literal>resolve</literal> to the line starting with
|
||||||
has to be added to the line starting with
|
<literal>hosts:</literal> in <filename>/etc/nsswitch.conf</filename>.</para>
|
||||||
<literal>hosts:</literal> in
|
|
||||||
<filename>/etc/nsswitch.conf</filename>.</para>
|
|
||||||
|
|
||||||
<para>It is recommended to place <literal>resolve</literal> early
|
<para>It is recommended to place <literal>resolve</literal> early in <filename>/etc/nsswitch.conf</filename>'
|
||||||
in the <filename>nsswitch.conf</filename> line (but after the
|
<literal>hosts:</literal> line (but after the <literal>files</literal> or <literal>mymachines</literal> entries),
|
||||||
<literal>files</literal> entry), replacing the
|
replacing the <literal>dns</literal> entry if it exists, to ensure DNS queries are always routed via
|
||||||
<literal>dns</literal> entry if it exists, 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>.</para>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
<refsect1>
|
<refsect1>
|
||||||
<title>Example</title>
|
<title>Example</title>
|
||||||
|
|
||||||
<para>Here is an example <filename>/etc/nsswitch.conf</filename>
|
<para>Here is an example <filename>/etc/nsswitch.conf</filename> file that enables <command>nss-resolve</command>
|
||||||
file that enables <command>resolve</command> correctly:</para>
|
correctly:</para>
|
||||||
|
|
||||||
<programlisting>passwd: compat mymachines
|
<programlisting>passwd: compat mymachines
|
||||||
group: compat mymachines
|
group: compat mymachines
|
||||||
shadow: compat
|
shadow: compat
|
||||||
|
|
||||||
hosts: files <command>resolve</command> mymachines myhostname
|
hosts: files mymachines <command>resolve</command> myhostname
|
||||||
networks: files
|
networks: files
|
||||||
|
|
||||||
protocols: db files
|
protocols: db files
|
||||||
@ -96,12 +95,6 @@ rpc: db files
|
|||||||
|
|
||||||
netgroup: nis</programlisting>
|
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>
|
||||||
|
|
||||||
<refsect1>
|
<refsect1>
|
||||||
|
Loading…
Reference in New Issue
Block a user