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