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