]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd.dnssd.xml
tree-wide: drop 'This file is part of systemd' blurb
[thirdparty/systemd.git] / man / systemd.dnssd.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 Copyright 2017 Dmitry Rozhkov
7 -->
8
9 <refentry id="systemd.dnssd" conditional='ENABLE_RESOLVE'>
10
11 <refentryinfo>
12 <title>systemd.dnssd</title>
13 <productname>systemd</productname>
14
15 <authorgroup>
16 <author>
17 <contrib>Developer</contrib>
18 <firstname>Dmitry</firstname>
19 <surname>Rozhkov</surname>
20 <email>dmitry.rozhkov@intel.com</email>
21 </author>
22 </authorgroup>
23 </refentryinfo>
24
25 <refmeta>
26 <refentrytitle>systemd.dnssd</refentrytitle>
27 <manvolnum>5</manvolnum>
28 </refmeta>
29
30 <refnamediv>
31 <refname>systemd.dnssd</refname>
32 <refpurpose>DNS-SD configuration</refpurpose>
33 </refnamediv>
34
35 <refsynopsisdiv>
36 <para><filename><replaceable>network_service</replaceable>.dnssd</filename></para>
37 </refsynopsisdiv>
38
39 <refsect1>
40 <title>Description</title>
41
42 <para>DNS-SD setup is performed by
43 <citerefentry><refentrytitle>systemd-resolved</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
44 </para>
45
46 <para>The main network service file must have the extension <filename>.dnssd</filename>; other
47 extensions are ignored.</para>
48
49 <para>The <filename>.dnssd</filename> files are read from the files located in the system
50 network directory <filename>/usr/lib/systemd/dnssd</filename>, the volatile runtime network
51 directory <filename>/run/systemd/dnssd</filename> and the local administration network
52 directory <filename>/etc/systemd/dnssd</filename>. All configuration files are collectively
53 sorted and processed in lexical order, regardless of the directories in which they live.
54 However, files with identical filenames replace each other. Files in <filename>/etc</filename>
55 have the highest priority, files in <filename>/run</filename> take precedence over files with
56 the same name in <filename>/usr/lib</filename>. This can be used to override a system-supplied
57 configuration file with a local file if needed.</para>
58
59 <para>Along with the network service file <filename>foo.dnssd</filename>, a "drop-in" directory
60 <filename>foo.dnssd.d/</filename> may exist. All files with the suffix
61 <literal>.conf</literal> from this directory will be parsed after the file itself is
62 parsed. This is useful to alter or add configuration settings, without having to modify the main
63 configuration file. Each drop-in file must have appropriate section headers.</para>
64
65 <para>In addition to <filename>/etc/systemd/dnssd</filename>, drop-in <literal>.d</literal>
66 directories can be placed in <filename>/usr/lib/systemd/dnssd</filename> or
67 <filename>/run/systemd/dnssd</filename> directories. Drop-in files in
68 <filename>/etc</filename> take precedence over those in <filename>/run</filename> which in turn
69 take precedence over those in <filename>/usr/lib</filename>. Drop-in files under any of these
70 directories take precedence over the main network service file wherever located. (Of course, since
71 <filename>/run</filename> is temporary and <filename>/usr/lib</filename> is for vendors, it is
72 unlikely drop-ins should be used in either of those places.)</para>
73 </refsect1>
74
75 <refsect1>
76 <title>[Service] Section Options</title>
77
78 <para>The network service file contains a <literal>[Service]</literal>
79 section, which specifies a discoverable network service announced in a
80 local network with Multicast DNS broadcasts.</para>
81
82 <variablelist class='network-directives'>
83 <varlistentry>
84 <term><varname>Name=</varname></term>
85 <listitem>
86 <para>An instance name of the network service as defined in the section 4.1.1 of <ulink
87 url="https://tools.ietf.org/html/rfc6763">RFC 6763</ulink>, e.g. <literal>webserver</literal>.</para>
88 <para>The option supports simple specifier expansion. The following expansions are understood:</para>
89 <table>
90 <title>Specifiers available</title>
91 <tgroup cols='3' align='left' colsep='1' rowsep='1'>
92 <colspec colname="spec" />
93 <colspec colname="mean" />
94 <colspec colname="detail" />
95 <thead>
96 <row>
97 <entry>Specifier</entry>
98 <entry>Meaning</entry>
99 <entry>Details</entry>
100 </row>
101 </thead>
102 <tbody>
103 <row>
104 <entry><literal>%m</literal></entry>
105 <entry>Machine ID</entry>
106 <entry>The machine ID of the running system, formatted as string. See <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry> for more information.</entry>
107 </row>
108 <row>
109 <entry><literal>%b</literal></entry>
110 <entry>Boot ID</entry>
111 <entry>The boot ID of the running system, formatted as string. See <citerefentry><refentrytitle>random</refentrytitle><manvolnum>4</manvolnum></citerefentry> for more information.</entry>
112 </row>
113 <row>
114 <entry><literal>%H</literal></entry>
115 <entry>Host name</entry>
116 <entry>The hostname of the running system.</entry>
117 </row>
118 <row>
119 <entry><literal>%v</literal></entry>
120 <entry>Kernel release</entry>
121 <entry>Identical to <command>uname -r</command> output.</entry>
122 </row>
123 </tbody>
124 </tgroup>
125 </table>
126 </listitem>
127 </varlistentry>
128 <varlistentry>
129 <term><varname>Type=</varname></term>
130 <listitem>
131 <para>A type of the network service as defined in the section 4.1.2 of <ulink
132 url="https://tools.ietf.org/html/rfc6763">RFC 6763</ulink>, e.g. <literal>_http._tcp</literal>.
133 </para>
134 </listitem>
135 </varlistentry>
136 <varlistentry>
137 <term><varname>Port=</varname></term>
138 <listitem>
139 <para>An IP port number of the network service.</para>
140 </listitem>
141 </varlistentry>
142 <varlistentry>
143 <term><varname>Priority=</varname></term>
144 <listitem>
145 <para>A priority number set in SRV resource records corresponding to the network service.</para>
146 </listitem>
147 </varlistentry>
148 <varlistentry>
149 <term><varname>Weight=</varname></term>
150 <listitem>
151 <para>A weight number set in SRV resource records corresponding to the network service.</para>
152 </listitem>
153 </varlistentry>
154 <varlistentry>
155 <term><varname>TxtText=</varname></term>
156 <listitem>
157 <para>A whitespace-separated list of arbitrary key/value pairs
158 conveying additional information about the named service in the corresponding TXT resource record,
159 e.g. <literal>path=/portal/index.html</literal>. Keys and values can contain C-style escape
160 sequences which get translated upon reading configuration files.
161 </para>
162 <para>This option together with <varname>TxtData=</varname> may be specified more than once, in which
163 case multiple TXT resource records will be created for the service. If the empty string is assigned to
164 this option, the list is reset and all prior assignments will have no effect.
165 </para>
166 </listitem>
167 </varlistentry>
168 <varlistentry>
169 <term><varname>TxtData=</varname></term>
170 <listitem>
171 <para>A whitespace-separated list of arbitrary key/value pairs
172 conveying additional information about the named service in the corresponding TXT resource record
173 where values are base64-encoded string representing any binary data,
174 e.g. <literal>data=YW55IGJpbmFyeSBkYXRhCg==</literal>. Keys can contain C-style escape
175 sequences which get translated upon reading configuration files.
176 </para>
177 <para>This option together with <varname>TxtText=</varname> may be specified more than once, in which
178 case multiple TXT resource records will be created for the service. If the empty string is assigned to
179 this option, the list is reset and all prior assignments will have no effect.
180 </para>
181 </listitem>
182 </varlistentry>
183 </variablelist>
184
185 </refsect1>
186
187 <refsect1>
188 <title>Examples</title>
189 <example>
190 <title>HTTP service</title>
191
192 <programlisting># /etc/systemd/dnssd/http.dnssd
193 [Service]
194 Name=%H
195 Type=_http._tcp
196 Port=80
197 TxtText=path=/stats/index.html t=temperature_sensor</programlisting>
198
199 <para>This makes the http server running on the host discoverable in the local network
200 given MulticastDNS is enabled on the network interface.</para>
201
202 <para>Now the utility <literal>resolvectl</literal> should be able to resolve the
203 service to the host's name:</para>
204
205 <programlisting>$ resolvectl service meteo._http._tcp.local
206 meteo._http._tcp.local: meteo.local:80 [priority=0, weight=0]
207 169.254.208.106%senp0s21f0u2u4
208 fe80::213:3bff:fe49:8aa%senp0s21f0u2u4
209 path=/stats/index.html
210 t=temperature_sensor
211 (meteo/_http._tcp/local)
212
213 -- Information acquired via protocol mDNS/IPv6 in 4.0ms.
214 -- Data is authenticated: yes</programlisting>
215
216 <para><literal>Avahi</literal> running on a different host in the same local network should see the service as well:</para>
217
218 <programlisting>$ avahi-browse -a -r
219 + enp3s0 IPv6 meteo Web Site local
220 + enp3s0 IPv4 meteo Web Site local
221 = enp3s0 IPv6 meteo Web Site local
222 hostname = [meteo.local]
223 address = [fe80::213:3bff:fe49:8aa]
224 port = [80]
225 txt = ["path=/stats/index.html" "t=temperature_sensor"]
226 = enp3s0 IPv4 meteo Web Site local
227 hostname = [meteo.local]
228 address = [169.254.208.106]
229 port = [80]
230 txt = ["path=/stats/index.html" "t=temperature_sensor"]</programlisting>
231
232 </example>
233 </refsect1>
234
235 <refsect1>
236 <title>See Also</title>
237 <para>
238 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
239 <citerefentry><refentrytitle>systemd-resolved.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
240 <citerefentry><refentrytitle>resolvectl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
241 </para>
242 </refsect1>
243
244 </refentry>