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