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