]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd-resolved.service.xml
man: document that resolved cares about /etc/hosts
[thirdparty/systemd.git] / man / systemd-resolved.service.xml
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 2014 Tom Gundersen
9
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
19
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22 -->
23
24 <refentry id="systemd-resolved.service" conditional='ENABLE_RESOLVED'>
25
26 <refentryinfo>
27 <title>systemd-resolved.service</title>
28 <productname>systemd</productname>
29
30 <authorgroup>
31 <author>
32 <contrib>Developer</contrib>
33 <firstname>Tom</firstname>
34 <surname>Gundersen</surname>
35 <email>teg@jklm.no</email>
36 </author>
37 </authorgroup>
38 </refentryinfo>
39
40 <refmeta>
41 <refentrytitle>systemd-resolved.service</refentrytitle>
42 <manvolnum>8</manvolnum>
43 </refmeta>
44
45 <refnamediv>
46 <refname>systemd-resolved.service</refname>
47 <refname>systemd-resolved</refname>
48 <refpurpose>Network Name Resolution manager</refpurpose>
49 </refnamediv>
50
51 <refsynopsisdiv>
52 <para><filename>systemd-resolved.service</filename></para>
53 <para><filename>/usr/lib/systemd/systemd-resolved</filename></para>
54 </refsynopsisdiv>
55
56 <refsect1>
57 <title>Description</title>
58
59 <para><command>systemd-resolved</command> is a system service that provides network name resolution to local
60 applications. It implements a caching and validating DNS/DNSSEC stub resolver, as well as an LLMNR resolver and
61 responder. In addition it maintains the <filename>/run/systemd/resolve/resolv.conf</filename> file for
62 compatibility with traditional Linux programs. This file may be symlinked from
63 <filename>/etc/resolv.conf</filename>.</para>
64
65 <para>The glibc NSS module
66 <citerefentry><refentrytitle>nss-resolve</refentrytitle><manvolnum>8</manvolnum></citerefentry> is required to
67 permit glibc's NSS resolver functions to resolve host names via <command>systemd-resolved</command>.</para>
68
69 <para>The DNS servers contacted are determined from the global
70 settings in <filename>/etc/systemd/resolved.conf</filename>, the
71 per-link static settings in <filename>/etc/systemd/network/*.network</filename> files,
72 and the per-link dynamic settings received over DHCP. See
73 <citerefentry><refentrytitle>resolved.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
74 and
75 <citerefentry><refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum></citerefentry>
76 for details. To improve compatibility,
77 <filename>/etc/resolv.conf</filename> is read in order to discover
78 configured system DNS servers, but only if it is not a symlink
79 to <filename>/run/systemd/resolve/resolv.conf</filename> (see above).</para>
80
81 <para><command>systemd-resolved</command> synthesizes DNS RRs for the following cases:</para>
82
83 <itemizedlist>
84 <listitem><para>The local, configured hostname is resolved to
85 all locally configured IP addresses ordered by their scope, or
86 — if none are configured — the IPv4 address 127.0.0.2 (which
87 is on the local loopback) and the IPv6 address ::1 (which is the
88 local host).</para></listitem>
89
90 <listitem><para>The hostname <literal>localhost</literal> (as well as any hostname ending in
91 <literal>.localhost</literal>, <literal>.localdomain</literal> or equal to <literal>localdomain</literal>) is
92 resolved to the IP addresses 127.0.0.1 and ::1.</para></listitem>
93
94 <listitem><para>The hostname <literal>gateway</literal> is
95 resolved to all current default routing gateway addresses,
96 ordered by their metric. This assigns a stable hostname to the
97 current gateway, useful for referencing it independently of the
98 current network configuration state.</para></listitem>
99
100 <listitem><para>The mappings defined in <filename>/etc/hosts</filename> are resolved to their configured
101 addresses and back.</para></listitem>
102 </itemizedlist>
103
104 <para>Lookup requests are routed to the available DNS servers
105 and LLMNR interfaces according to the following rules:</para>
106
107 <itemizedlist>
108 <listitem><para>Lookups for the special hostname
109 <literal>localhost</literal> are never routed to the
110 network. (A few other, special domains are handled the same way.)</para></listitem>
111
112 <listitem><para>Single-label names are routed to all local
113 interfaces capable of IP multicasting, using the LLMNR
114 protocol. Lookups for IPv4 addresses are only sent via LLMNR on
115 IPv4, and lookups for IPv6 addresses are only sent via LLMNR on
116 IPv6. Lookups for the locally configured host name and the
117 <literal>gateway</literal> host name are never routed to
118 LLMNR.</para></listitem>
119
120 <listitem><para>Multi-label names are routed to all local
121 interfaces that have a DNS sever configured, plus the globally
122 configured DNS server if there is one. Address lookups from the
123 link-local address range are never routed to
124 DNS.</para></listitem>
125 </itemizedlist>
126
127 <para>If lookups are routed to multiple interfaces, the first
128 successful response is returned (thus effectively merging the
129 lookup zones on all matching interfaces). If the lookup failed on
130 all interfaces, the last failing response is returned.</para>
131
132 <para>Routing of lookups may be influenced by configuring
133 per-interface domain names. See
134 <citerefentry><refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum></citerefentry>
135 for details. Lookups for a hostname ending in one of the
136 per-interface domains are exclusively routed to the matching
137 interfaces.</para>
138
139 <para>Note that <filename>/run/systemd/resolve/resolv.conf</filename> should not be used directly by applications,
140 but only through a symlink from <filename>/etc/resolv.conf</filename>.</para>
141
142 <para>See the <ulink url="http://www.freedesktop.org/wiki/Software/systemd/resolved"> resolved D-Bus API
143 Documentation</ulink> for information about the APIs <filename>systemd-resolved</filename> provides.</para>
144
145 </refsect1>
146
147 <refsect1>
148 <title>See Also</title>
149 <para>
150 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
151 <citerefentry><refentrytitle>resolved.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
152 <citerefentry><refentrytitle>dnssec-trust-anchors.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
153 <citerefentry><refentrytitle>nss-resolve</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
154 <citerefentry><refentrytitle>systemd-resolve</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
155 <citerefentry project='man-pages'><refentrytitle>resolv.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
156 <citerefentry project='man-pages'><refentrytitle>hosts</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
157 <citerefentry><refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
158 <citerefentry><refentrytitle>systemd-networkd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
159 </para>
160 </refsect1>
161
162 </refentry>