]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/nss-resolve.xml
tree-wide: beautify remaining copyright statements
[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 SPDX-License-Identifier: LGPL-2.1+
7
8 Copyright © 2013 Tom Gundersen
9 -->
10
11 <refentry id="nss-resolve" conditional='ENABLE_RESOLVE'>
12
13 <refentryinfo>
14 <title>nss-resolve</title>
15 <productname>systemd</productname>
16
17 <authorgroup>
18 <author>
19 <contrib>Developer</contrib>
20 <firstname>Lennart</firstname>
21 <surname>Poettering</surname>
22 <email>lennart@poettering.net</email>
23 </author>
24 </authorgroup>
25 </refentryinfo>
26
27 <refmeta>
28 <refentrytitle>nss-resolve</refentrytitle>
29 <manvolnum>8</manvolnum>
30 </refmeta>
31
32 <refnamediv>
33 <refname>nss-resolve</refname>
34 <refname>libnss_resolve.so.2</refname>
35 <refpurpose>Provide hostname resolution via <filename>systemd-resolved.service</filename></refpurpose>
36 </refnamediv>
37
38 <refsynopsisdiv>
39 <para><filename>libnss_resolve.so.2</filename></para>
40 </refsynopsisdiv>
41
42 <refsect1>
43 <title>Description</title>
44
45 <para><command>nss-resolve</command> is a plug-in module for the GNU Name Service Switch (NSS) functionality of the
46 GNU C Library (<command>glibc</command>) enabling it to resolve host names via the
47 <citerefentry><refentrytitle>systemd-resolved</refentrytitle><manvolnum>8</manvolnum></citerefentry> local network
48 name resolution service. It replaces the <command>nss-dns</command> plug-in module that traditionally resolves
49 hostnames via DNS.</para>
50
51 <para>To activate the NSS module, add <literal>resolve</literal> to the line starting with
52 <literal>hosts:</literal> in <filename>/etc/nsswitch.conf</filename>. Specifically, it is recommended to place
53 <literal>resolve</literal> early in <filename>/etc/nsswitch.conf</filename>'s <literal>hosts:</literal> line (but
54 after the <literal>files</literal> or <literal>mymachines</literal> entries), right before the
55 <literal>dns</literal> entry if it exists, followed by <literal>[!UNAVAIL=return]</literal>, to ensure DNS queries
56 are always routed via
57 <citerefentry><refentrytitle>systemd-resolved</refentrytitle><manvolnum>8</manvolnum></citerefentry> if it is
58 running, but are routed to <command>nss-dns</command> if this service is not available.</para>
59
60 <para>Note that <command>systemd-resolved</command> will synthesize DNS resource
61 records in a few cases, for example for <literal>localhost</literal> and the
62 current hostname, see
63 <citerefentry><refentrytitle>systemd-resolved</refentrytitle><manvolnum>8</manvolnum></citerefentry>
64 for the full list. This duplicates the functionality of
65 <citerefentry><refentrytitle>nss-myhostname</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
66 but it is still recommended (see examples below) to keep
67 <command>nss-myhostname</command> configured in
68 <filename>/etc/nsswitch.conf</filename>, to keep those names resolveable if
69 <command>systemd-resolved</command> is not running.</para>
70 </refsect1>
71
72 <refsect1>
73 <title>Example</title>
74
75 <para>Here is an example <filename>/etc/nsswitch.conf</filename> file that enables <command>nss-resolve</command>
76 correctly:</para>
77
78 <programlisting>passwd: compat mymachines systemd
79 group: compat mymachines systemd
80 shadow: compat
81
82 hosts: files mymachines <command>resolve [!UNAVAIL=return]</command> dns myhostname
83 networks: files
84
85 protocols: db files
86 services: db files
87 ethers: db files
88 rpc: db files
89
90 netgroup: nis</programlisting>
91 </refsect1>
92
93 <refsect1>
94 <title>See Also</title>
95 <para>
96 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
97 <citerefentry><refentrytitle>systemd-resolved</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
98 <citerefentry><refentrytitle>nss-systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
99 <citerefentry><refentrytitle>nss-myhostname</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
100 <citerefentry><refentrytitle>nss-mymachines</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
101 <citerefentry project='man-pages'><refentrytitle>nsswitch.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
102 </para>
103 </refsect1>
104
105 </refentry>