]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/nss-resolve.xml
Merge pull request #6271 from poettering/resolved-switching
[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>. Specifically, it is recommended to place
67 <literal>resolve</literal> early in <filename>/etc/nsswitch.conf</filename>'s <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
74 <para>Note that <command>systemd-resolved</command> will synthesize DNS resource
75 records in a few cases, for example for the <literal>localhost</literal> and the
76 current hostname, see
77 <citerefentry><refentrytitle>systemd-resolved</refentrytitle><manvolnum>8</manvolnum></citerefentry>
78 for the full list. This duplicates the functionality of
79 <citerefentry><refentrytitle>nss-myhostname</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
80 but it is still recommended (see examples below) to keep
81 <command>nss-myhostname</command> configured in
82 <filename>/etc/nsswitch.conf</filename>, to keep those names resolveable if
83 <command>systemd-resolved</command> is not running.</para>
84 </refsect1>
85
86 <refsect1>
87 <title>Example</title>
88
89 <para>Here is an example <filename>/etc/nsswitch.conf</filename> file that enables <command>nss-resolve</command>
90 correctly:</para>
91
92 <programlisting>passwd: compat mymachines systemd
93 group: compat mymachines systemd
94 shadow: compat
95
96 hosts: files mymachines <command>resolve [!UNAVAIL=return]</command> dns myhostname
97 networks: files
98
99 protocols: db files
100 services: db files
101 ethers: db files
102 rpc: db files
103
104 netgroup: nis</programlisting>
105 </refsect1>
106
107 <refsect1>
108 <title>See Also</title>
109 <para>
110 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
111 <citerefentry><refentrytitle>systemd-resolved</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
112 <citerefentry><refentrytitle>nss-systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
113 <citerefentry><refentrytitle>nss-myhostname</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
114 <citerefentry><refentrytitle>nss-mymachines</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
115 <citerefentry project='man-pages'><refentrytitle>nsswitch.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
116 </para>
117 </refsect1>
118
119 </refentry>