]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/nss-resolve.xml
man: fix link markup
[thirdparty/systemd.git] / man / nss-resolve.xml
CommitLineData
514094f9 1<?xml version='1.0'?>
3a54a157 2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
0d6868f9 3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
0307f791 4<!-- SPDX-License-Identifier: LGPL-2.1+ -->
0d6868f9 5
08540a95 6<refentry id="nss-resolve" conditional='ENABLE_NSS_RESOLVE'>
0d6868f9
LP
7
8 <refentryinfo>
9 <title>nss-resolve</title>
10 <productname>systemd</productname>
0d6868f9
LP
11 </refentryinfo>
12
13 <refmeta>
14 <refentrytitle>nss-resolve</refentrytitle>
15 <manvolnum>8</manvolnum>
16 </refmeta>
17
18 <refnamediv>
19 <refname>nss-resolve</refname>
20 <refname>libnss_resolve.so.2</refname>
e9dd6984 21 <refpurpose>Hostname resolution via <filename>systemd-resolved.service</filename></refpurpose>
0d6868f9
LP
22 </refnamediv>
23
24 <refsynopsisdiv>
25 <para><filename>libnss_resolve.so.2</filename></para>
26 </refsynopsisdiv>
27
28 <refsect1>
29 <title>Description</title>
30
9053aaad 31 <para><command>nss-resolve</command> is a plug-in module for the GNU Name Service Switch (NSS) functionality of the
38b38500 32 GNU C Library (<command>glibc</command>) enabling it to resolve hostnames via the
9053aaad
LP
33 <citerefentry><refentrytitle>systemd-resolved</refentrytitle><manvolnum>8</manvolnum></citerefentry> local network
34 name resolution service. It replaces the <command>nss-dns</command> plug-in module that traditionally resolves
35 hostnames via DNS.</para>
36
44b7aedb
ZJS
37 <para>To activate the NSS module, add <literal>resolve [!UNAVAIL=return]</literal> to the line starting
38 with <literal>hosts:</literal> in <filename>/etc/nsswitch.conf</filename>. Specifically, it is
39 recommended to place <literal>resolve</literal> early in <filename>/etc/nsswitch.conf</filename>'s
40 <literal>hosts:</literal> line. It should be before the <literal>files</literal> entry, since
41 <filename>systemd-resolved</filename> supports <filename>/etc/hosts</filename> internally, but with
42 caching. To the contrary, it should be after <literal>mymachines</literal>, to give hostnames given to
43 local VMs and containers precedence over names received over DNS. Finally, we recommend placing
44 <literal>dns</literal> somewhere after <literal>resolve</literal>, to fall back to
45 <command>nss-dns</command> if <filename>systemd-resolved.service</filename> is not available.</para>
2b015ea4
ZJS
46
47 <para>Note that <command>systemd-resolved</command> will synthesize DNS resource
25fb19da 48 records in a few cases, for example for <literal>localhost</literal> and the
2b015ea4
ZJS
49 current hostname, see
50 <citerefentry><refentrytitle>systemd-resolved</refentrytitle><manvolnum>8</manvolnum></citerefentry>
51 for the full list. This duplicates the functionality of
52 <citerefentry><refentrytitle>nss-myhostname</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
53 but it is still recommended (see examples below) to keep
54 <command>nss-myhostname</command> configured in
55 <filename>/etc/nsswitch.conf</filename>, to keep those names resolveable if
56 <command>systemd-resolved</command> is not running.</para>
0d6868f9
LP
57 </refsect1>
58
59 <refsect1>
60 <title>Example</title>
61
9053aaad
LP
62 <para>Here is an example <filename>/etc/nsswitch.conf</filename> file that enables <command>nss-resolve</command>
63 correctly:</para>
0d6868f9 64
94f760ec 65 <!-- synchronize with other nss-* man pages and factory/etc/nsswitch.conf -->
38ccb557
LP
66<programlisting>passwd: compat systemd
67group: compat systemd
0d6868f9
LP
68shadow: compat
69
f2a20e99 70hosts: mymachines <command>resolve [!UNAVAIL=return]</command> myhostname files dns
0d6868f9
LP
71networks: files
72
73protocols: db files
74services: db files
75ethers: db files
76rpc: db files
77
78netgroup: nis</programlisting>
0d6868f9
LP
79 </refsect1>
80
81 <refsect1>
82 <title>See Also</title>
83 <para>
84 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
85 <citerefentry><refentrytitle>systemd-resolved</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
409093fe 86 <citerefentry><refentrytitle>nss-systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
0d6868f9 87 <citerefentry><refentrytitle>nss-myhostname</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
409093fe 88 <citerefentry><refentrytitle>nss-mymachines</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
0d6868f9
LP
89 <citerefentry project='man-pages'><refentrytitle>nsswitch.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
90 </para>
91 </refsect1>
92
93</refentry>