]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/nss-resolve.xml
verify: use manager_load_startable_unit_or_warn() to load units for verification
[thirdparty/systemd.git] / man / nss-resolve.xml
CommitLineData
0d6868f9
LP
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<!--
572eb058
ZJS
6 SPDX-License-Identifier: LGPL-2.1+
7
0d6868f9
LP
8 This file is part of systemd.
9
10 Copyright 2011 Lennart Poettering
11 Copyright 2013 Tom Gundersen
12
13 systemd is free software; you can redistribute it and/or modify it
14 under the terms of the GNU Lesser General Public License as published by
15 the Free Software Foundation; either version 2.1 of the License, or
16 (at your option) any later version.
17
18 systemd is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 Lesser General Public License for more details.
22
23 You should have received a copy of the GNU Lesser General Public License
24 along with systemd; If not, see <http://www.gnu.org/licenses/>.
25-->
26
1ec57f33 27<refentry id="nss-resolve" conditional='ENABLE_RESOLVE'>
0d6868f9
LP
28
29 <refentryinfo>
30 <title>nss-resolve</title>
31 <productname>systemd</productname>
32
33 <authorgroup>
34 <author>
35 <contrib>Developer</contrib>
36 <firstname>Lennart</firstname>
37 <surname>Poettering</surname>
38 <email>lennart@poettering.net</email>
39 </author>
40 </authorgroup>
41 </refentryinfo>
42
43 <refmeta>
44 <refentrytitle>nss-resolve</refentrytitle>
45 <manvolnum>8</manvolnum>
46 </refmeta>
47
48 <refnamediv>
49 <refname>nss-resolve</refname>
50 <refname>libnss_resolve.so.2</refname>
51 <refpurpose>Provide hostname resolution via <filename>systemd-resolved.service</filename></refpurpose>
52 </refnamediv>
53
54 <refsynopsisdiv>
55 <para><filename>libnss_resolve.so.2</filename></para>
56 </refsynopsisdiv>
57
58 <refsect1>
59 <title>Description</title>
60
9053aaad
LP
61 <para><command>nss-resolve</command> is a plug-in module for the GNU Name Service Switch (NSS) functionality of the
62 GNU C Library (<command>glibc</command>) enabling it to resolve host names via the
63 <citerefentry><refentrytitle>systemd-resolved</refentrytitle><manvolnum>8</manvolnum></citerefentry> local network
64 name resolution service. It replaces the <command>nss-dns</command> plug-in module that traditionally resolves
65 hostnames via DNS.</para>
66
67 <para>To activate the NSS module, add <literal>resolve</literal> to the line starting with
2b015ea4
ZJS
68 <literal>hosts:</literal> in <filename>/etc/nsswitch.conf</filename>. Specifically, it is recommended to place
69 <literal>resolve</literal> early in <filename>/etc/nsswitch.conf</filename>'s <literal>hosts:</literal> line (but
640be880
LP
70 after the <literal>files</literal> or <literal>mymachines</literal> entries), right before the
71 <literal>dns</literal> entry if it exists, followed by <literal>[!UNAVAIL=return]</literal>, to ensure DNS queries
72 are always routed via
73 <citerefentry><refentrytitle>systemd-resolved</refentrytitle><manvolnum>8</manvolnum></citerefentry> if it is
74 running, but are routed to <command>nss-dns</command> if this service is not available.</para>
2b015ea4
ZJS
75
76 <para>Note that <command>systemd-resolved</command> will synthesize DNS resource
25fb19da 77 records in a few cases, for example for <literal>localhost</literal> and the
2b015ea4
ZJS
78 current hostname, see
79 <citerefentry><refentrytitle>systemd-resolved</refentrytitle><manvolnum>8</manvolnum></citerefentry>
80 for the full list. This duplicates the functionality of
81 <citerefentry><refentrytitle>nss-myhostname</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
82 but it is still recommended (see examples below) to keep
83 <command>nss-myhostname</command> configured in
84 <filename>/etc/nsswitch.conf</filename>, to keep those names resolveable if
85 <command>systemd-resolved</command> is not running.</para>
0d6868f9
LP
86 </refsect1>
87
88 <refsect1>
89 <title>Example</title>
90
9053aaad
LP
91 <para>Here is an example <filename>/etc/nsswitch.conf</filename> file that enables <command>nss-resolve</command>
92 correctly:</para>
0d6868f9 93
409093fe
LP
94<programlisting>passwd: compat mymachines systemd
95group: compat mymachines systemd
0d6868f9
LP
96shadow: compat
97
75555c28 98hosts: files mymachines <command>resolve [!UNAVAIL=return]</command> dns myhostname
0d6868f9
LP
99networks: files
100
101protocols: db files
102services: db files
103ethers: db files
104rpc: db files
105
106netgroup: nis</programlisting>
0d6868f9
LP
107 </refsect1>
108
109 <refsect1>
110 <title>See Also</title>
111 <para>
112 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
113 <citerefentry><refentrytitle>systemd-resolved</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
409093fe 114 <citerefentry><refentrytitle>nss-systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
0d6868f9 115 <citerefentry><refentrytitle>nss-myhostname</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
409093fe 116 <citerefentry><refentrytitle>nss-mymachines</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
0d6868f9
LP
117 <citerefentry project='man-pages'><refentrytitle>nsswitch.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
118 </para>
119 </refsect1>
120
121</refentry>