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