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