Debian Codegraph @

man/systemd.dnssd.xml

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