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