]>
Commit | Line | Data |
---|---|---|
514094f9 | 1 | <?xml version='1.0'?> |
3a54a157 | 2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
0d6868f9 | 3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> |
0307f791 | 4 | <!-- SPDX-License-Identifier: LGPL-2.1+ --> |
0d6868f9 | 5 | |
08540a95 | 6 | <refentry id="nss-resolve" conditional='ENABLE_NSS_RESOLVE'> |
0d6868f9 LP |
7 | |
8 | <refentryinfo> | |
9 | <title>nss-resolve</title> | |
10 | <productname>systemd</productname> | |
0d6868f9 LP |
11 | </refentryinfo> |
12 | ||
13 | <refmeta> | |
14 | <refentrytitle>nss-resolve</refentrytitle> | |
15 | <manvolnum>8</manvolnum> | |
16 | </refmeta> | |
17 | ||
18 | <refnamediv> | |
19 | <refname>nss-resolve</refname> | |
20 | <refname>libnss_resolve.so.2</refname> | |
21 | <refpurpose>Provide hostname resolution via <filename>systemd-resolved.service</filename></refpurpose> | |
22 | </refnamediv> | |
23 | ||
24 | <refsynopsisdiv> | |
25 | <para><filename>libnss_resolve.so.2</filename></para> | |
26 | </refsynopsisdiv> | |
27 | ||
28 | <refsect1> | |
29 | <title>Description</title> | |
30 | ||
9053aaad LP |
31 | <para><command>nss-resolve</command> is a plug-in module for the GNU Name Service Switch (NSS) functionality of the |
32 | GNU C Library (<command>glibc</command>) enabling it to resolve host names via the | |
33 | <citerefentry><refentrytitle>systemd-resolved</refentrytitle><manvolnum>8</manvolnum></citerefentry> local network | |
34 | name resolution service. It replaces the <command>nss-dns</command> plug-in module that traditionally resolves | |
35 | hostnames via DNS.</para> | |
36 | ||
37 | <para>To activate the NSS module, add <literal>resolve</literal> to the line starting with | |
2b015ea4 ZJS |
38 | <literal>hosts:</literal> in <filename>/etc/nsswitch.conf</filename>. Specifically, it is recommended to place |
39 | <literal>resolve</literal> early in <filename>/etc/nsswitch.conf</filename>'s <literal>hosts:</literal> line (but | |
640be880 LP |
40 | after the <literal>files</literal> or <literal>mymachines</literal> entries), right before the |
41 | <literal>dns</literal> entry if it exists, followed by <literal>[!UNAVAIL=return]</literal>, to ensure DNS queries | |
42 | are always routed via | |
43 | <citerefentry><refentrytitle>systemd-resolved</refentrytitle><manvolnum>8</manvolnum></citerefentry> if it is | |
44 | running, but are routed to <command>nss-dns</command> if this service is not available.</para> | |
2b015ea4 ZJS |
45 | |
46 | <para>Note that <command>systemd-resolved</command> will synthesize DNS resource | |
25fb19da | 47 | records in a few cases, for example for <literal>localhost</literal> and the |
2b015ea4 ZJS |
48 | current hostname, see |
49 | <citerefentry><refentrytitle>systemd-resolved</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
50 | for the full list. This duplicates the functionality of | |
51 | <citerefentry><refentrytitle>nss-myhostname</refentrytitle><manvolnum>8</manvolnum></citerefentry>, | |
52 | but it is still recommended (see examples below) to keep | |
53 | <command>nss-myhostname</command> configured in | |
54 | <filename>/etc/nsswitch.conf</filename>, to keep those names resolveable if | |
55 | <command>systemd-resolved</command> is not running.</para> | |
0d6868f9 LP |
56 | </refsect1> |
57 | ||
58 | <refsect1> | |
59 | <title>Example</title> | |
60 | ||
9053aaad LP |
61 | <para>Here is an example <filename>/etc/nsswitch.conf</filename> file that enables <command>nss-resolve</command> |
62 | correctly:</para> | |
0d6868f9 | 63 | |
94f760ec | 64 | <!-- synchronize with other nss-* man pages and factory/etc/nsswitch.conf --> |
409093fe LP |
65 | <programlisting>passwd: compat mymachines systemd |
66 | group: compat mymachines systemd | |
0d6868f9 LP |
67 | shadow: compat |
68 | ||
75555c28 | 69 | hosts: files mymachines <command>resolve [!UNAVAIL=return]</command> dns myhostname |
0d6868f9 LP |
70 | networks: files |
71 | ||
72 | protocols: db files | |
73 | services: db files | |
74 | ethers: db files | |
75 | rpc: db files | |
76 | ||
77 | netgroup: nis</programlisting> | |
0d6868f9 LP |
78 | </refsect1> |
79 | ||
80 | <refsect1> | |
81 | <title>See Also</title> | |
82 | <para> | |
83 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
84 | <citerefentry><refentrytitle>systemd-resolved</refentrytitle><manvolnum>8</manvolnum></citerefentry>, | |
409093fe | 85 | <citerefentry><refentrytitle>nss-systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>, |
0d6868f9 | 86 | <citerefentry><refentrytitle>nss-myhostname</refentrytitle><manvolnum>8</manvolnum></citerefentry>, |
409093fe | 87 | <citerefentry><refentrytitle>nss-mymachines</refentrytitle><manvolnum>8</manvolnum></citerefentry>, |
0d6868f9 LP |
88 | <citerefentry project='man-pages'><refentrytitle>nsswitch.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry> |
89 | </para> | |
90 | </refsect1> | |
91 | ||
92 | </refentry> |