]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/nss-resolve.xml
man: make /etc/nsswitch.conf documentation for nss-resolve match example
[thirdparty/systemd.git] / man / nss-resolve.xml
1 <?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4
5 <!--
6 This file is part of systemd.
7
8 Copyright 2011 Lennart Poettering
9 Copyright 2013 Tom Gundersen
10
11 systemd is free software; you can redistribute it and/or modify it
12 under the terms of the GNU Lesser General Public License as published by
13 the Free Software Foundation; either version 2.1 of the License, or
14 (at your option) any later version.
15
16 systemd is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 Lesser General Public License for more details.
20
21 You should have received a copy of the GNU Lesser General Public License
22 along with systemd; If not, see <http://www.gnu.org/licenses/>.
23 -->
24
25 <refentry id="nss-resolve" conditional='ENABLE_RESOLVED'>
26
27 <refentryinfo>
28 <title>nss-resolve</title>
29 <productname>systemd</productname>
30
31 <authorgroup>
32 <author>
33 <contrib>Developer</contrib>
34 <firstname>Lennart</firstname>
35 <surname>Poettering</surname>
36 <email>lennart@poettering.net</email>
37 </author>
38 </authorgroup>
39 </refentryinfo>
40
41 <refmeta>
42 <refentrytitle>nss-resolve</refentrytitle>
43 <manvolnum>8</manvolnum>
44 </refmeta>
45
46 <refnamediv>
47 <refname>nss-resolve</refname>
48 <refname>libnss_resolve.so.2</refname>
49 <refpurpose>Provide hostname resolution via <filename>systemd-resolved.service</filename></refpurpose>
50 </refnamediv>
51
52 <refsynopsisdiv>
53 <para><filename>libnss_resolve.so.2</filename></para>
54 </refsynopsisdiv>
55
56 <refsect1>
57 <title>Description</title>
58
59 <para><command>nss-resolve</command> is a plug-in module for the GNU Name Service Switch (NSS) functionality of the
60 GNU C Library (<command>glibc</command>) enabling it to resolve host names via the
61 <citerefentry><refentrytitle>systemd-resolved</refentrytitle><manvolnum>8</manvolnum></citerefentry> local network
62 name resolution service. It replaces the <command>nss-dns</command> plug-in module that traditionally resolves
63 hostnames via DNS.</para>
64
65 <para>To activate the NSS module, add <literal>resolve</literal> to the line starting with
66 <literal>hosts:</literal> in <filename>/etc/nsswitch.conf</filename>. Specifcally, it is recommended to place
67 <literal>resolve</literal> early in <filename>/etc/nsswitch.conf</filename>' <literal>hosts:</literal> line (but
68 after the <literal>files</literal> or <literal>mymachines</literal> entries), right before the
69 <literal>dns</literal> entry if it exists, followed by <literal>[!UNAVAIL=return]</literal>, to ensure DNS queries
70 are always routed via
71 <citerefentry><refentrytitle>systemd-resolved</refentrytitle><manvolnum>8</manvolnum></citerefentry> if it is
72 running, but are routed to <command>nss-dns</command> if this service is not available.</para>
73 </refsect1>
74
75 <refsect1>
76 <title>Example</title>
77
78 <para>Here is an example <filename>/etc/nsswitch.conf</filename> file that enables <command>nss-resolve</command>
79 correctly:</para>
80
81 <programlisting>passwd: compat mymachines systemd
82 group: compat mymachines systemd
83 shadow: compat
84
85 hosts: files mymachines <command>resolve [!UNAVAIL=return]</command> dns myhostname
86 networks: files
87
88 protocols: db files
89 services: db files
90 ethers: db files
91 rpc: db files
92
93 netgroup: nis</programlisting>
94 </refsect1>
95
96 <refsect1>
97 <title>See Also</title>
98 <para>
99 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
100 <citerefentry><refentrytitle>systemd-resolved</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
101 <citerefentry><refentrytitle>nss-systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
102 <citerefentry><refentrytitle>nss-myhostname</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
103 <citerefentry><refentrytitle>nss-mymachines</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
104 <citerefentry project='man-pages'><refentrytitle>nsswitch.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
105 </para>
106 </refsect1>
107
108 </refentry>