]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd.link.xml
gpt-auto-generator: allow type check to fail
[thirdparty/systemd.git] / man / systemd.link.xml
CommitLineData
1ff28eae 1<?xml version='1.0'?> <!--*-nxml-*-->
1ff28eae 2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
798d3a52 3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
1ff28eae
TG
4
5<!--
6 This file is part of systemd.
7
8 Copyright 2014 Tom Gundersen
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.link">
798d3a52
ZJS
25 <refentryinfo>
26 <title>systemd.link</title>
27 <productname>systemd</productname>
1ff28eae 28
798d3a52
ZJS
29 <authorgroup>
30 <author>
31 <contrib>Developer</contrib>
32 <firstname>Tom</firstname>
33 <surname>Gundersen</surname>
34 </author>
35 </authorgroup>
36 </refentryinfo>
1ff28eae 37
798d3a52
ZJS
38 <refmeta>
39 <refentrytitle>systemd.link</refentrytitle>
40 <manvolnum>5</manvolnum>
41 </refmeta>
1ff28eae 42
798d3a52
ZJS
43 <refnamediv>
44 <refname>systemd.link</refname>
45 <refpurpose>Network device configuration</refpurpose>
46 </refnamediv>
1ff28eae 47
798d3a52
ZJS
48 <refsynopsisdiv>
49 <para><filename><replaceable>link</replaceable>.link</filename></para>
50 </refsynopsisdiv>
1ff28eae 51
798d3a52
ZJS
52 <refsect1>
53 <title>Description</title>
1ff28eae 54
798d3a52
ZJS
55 <para>Network link configuration is performed by the
56 <command>net_setup_link</command> udev builtin.</para>
1ff28eae 57
798d3a52
ZJS
58 <para>The link files are read from the files located in the system
59 network directory <filename>/usr/lib/systemd/network</filename>,
60 the volatile runtime network directory
61 <filename>/run/systemd/network</filename>, and the local
62 administration network directory
63 <filename>/etc/systemd/network</filename>. Link files must have
64 the extension <filename>.link</filename>; other extensions are
65 ignored. All link files are collectively sorted and processed in
66 lexical order, regardless of the directories in which they live.
67 However, files with identical filenames replace each other. Files
68 in <filename>/etc</filename> have the highest priority, files in
69 <filename>/run</filename> take precedence over files with the same
70 name in <filename>/usr/lib</filename>. This can be used to
71 override a system-supplied link file with a local file if needed;
72 a symlink in <filename>/etc</filename> with the same name as a
73 link file in <filename>/usr/lib</filename>, pointing to
74 <filename>/dev/null</filename>, disables the link file
75 entirely.</para>
1ff28eae 76
798d3a52
ZJS
77 <para>The link file contains a <literal>[Match]</literal> section,
78 which determines if a given link file may be applied to a given
79 device, as well as a <literal>[Link]</literal> section specifying
80 how the device should be configured. The first (in lexical order)
81 of the link files that matches a given device is applied. Note
82 that a default file <filename>99-default.link</filename> is
83 shipped by the system, any user-supplied
84 <filename>.link</filename> should hence have a lexically earlier
85 name to be considered at all.</para>
86 </refsect1>
102bd40e 87
798d3a52
ZJS
88 <refsect1>
89 <title>[Match] Section Options</title>
1ff28eae 90
798d3a52
ZJS
91 <para>A link file is said to match a device if each of the entries
92 in the <literal>[Match]</literal> section matches, or if the
93 section is empty. The following keys are accepted:</para>
1ff28eae 94
798d3a52
ZJS
95 <variablelist class='network-directives'>
96 <varlistentry>
97 <term><varname>MACAddress=</varname></term>
98 <listitem>
99 <para>The hardware address.</para>
100 </listitem>
101 </varlistentry>
102 <varlistentry>
103 <term><varname>OriginalName=</varname></term>
104 <listitem>
5256e00e
TG
105 <para>A whitespace-separated list of shell-style globs matching
106 the device name, as exposed by the udev property
107 "INTERFACE". This can not be used to match on names that have
108 already been changed from userspace. Caution is advised when matching on
798d3a52
ZJS
109 kernel-assigned names, as they are known to be unstable
110 between reboots.</para>
111 </listitem>
112 </varlistentry>
113 <varlistentry>
114 <term><varname>Path=</varname></term>
115 <listitem>
5256e00e
TG
116 <para>A whitespace-separated list of shell-style globs matching
117 the persistent path, as exposed by the udev property
118 <literal>ID_PATH</literal>.</para>
798d3a52
ZJS
119 </listitem>
120 </varlistentry>
121 <varlistentry>
122 <term><varname>Driver=</varname></term>
123 <listitem>
5256e00e
TG
124 <para>A whitespace-separated list of shell-style globs matching
125 the driver currently bound to the device,
798d3a52
ZJS
126 as exposed by the udev property <literal>DRIVER</literal>
127 of its parent device, or if that is not set, the
128 driver as exposed by <literal>ethtool -i</literal>
129 of the device itself.</para>
130 </listitem>
131 </varlistentry>
132 <varlistentry>
133 <term><varname>Type=</varname></term>
134 <listitem>
5256e00e
TG
135 <para>A whitespace-separated list of shell-style globs matching
136 the device type, as exposed by the udev
798d3a52
ZJS
137 property <literal>DEVTYPE</literal>.</para>
138 </listitem>
139 </varlistentry>
140 <varlistentry>
141 <term><varname>Host=</varname></term>
142 <listitem>
143 <para>Matches against the hostname or machine
144 ID of the host. See <literal>ConditionHost=</literal> in
145 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
146 for details.</para>
147 </listitem>
148 </varlistentry>
149 <varlistentry>
150 <term><varname>Virtualization=</varname></term>
151 <listitem>
152 <para>Checks whether the system is executed in
153 a virtualized environment and optionally test
154 whether it is a specific implementation. See
155 <literal>ConditionVirtualization=</literal> in
156 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
157 for details.</para>
158 </listitem>
159 </varlistentry>
160 <varlistentry>
161 <term><varname>KernelCommandLine=</varname></term>
162 <listitem>
163 <para>Checks whether a specific kernel command line option
164 is set (or if prefixed with the exclamation mark unset). See
165 <literal>ConditionKernelCommandLine=</literal> in
166 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
167 for details.</para>
168 </listitem>
169 </varlistentry>
170 <varlistentry>
171 <term><varname>Architecture=</varname></term>
172 <listitem>
173 <para>Checks whether the system is running on a specific
174 architecture. See <literal>ConditionArchitecture=</literal>
175 in
176 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
177 for details.</para>
178 </listitem>
179 </varlistentry>
180 </variablelist>
1ff28eae 181
798d3a52 182 </refsect1>
102bd40e 183
798d3a52
ZJS
184 <refsect1>
185 <title>[Link] Section Options</title>
102bd40e 186
798d3a52
ZJS
187 <para>The <literal>[Link]</literal> section accepts the following
188 keys:</para>
1ff28eae 189
798d3a52
ZJS
190 <variablelist class='network-directives'>
191 <varlistentry>
192 <term><varname>Description=</varname></term>
193 <listitem>
194 <para>A description of the device.</para>
195 </listitem>
196 </varlistentry>
197 <varlistentry>
198 <term><varname>Alias=</varname></term>
199 <listitem>
200 <para>The <literal>ifalias</literal> is set to this
201 value.</para>
202 </listitem>
203 </varlistentry>
204 <varlistentry>
205 <term><varname>MACAddressPolicy=</varname></term>
206 <listitem>
207 <para>The policy by which the MAC address should be set. The
208 available policies are:
209 </para>
1ff28eae 210
798d3a52
ZJS
211 <variablelist>
212 <varlistentry>
213 <term><literal>persistent</literal></term>
214 <listitem>
215 <para>If the hardware has a persistent MAC address, as
216 most hardware should, and if it is used by the kernel,
217 nothing is done. Otherwise, a new MAC address is
218 generated which is guaranteed to be the same on every
219 boot for the given machine and the given device, but
1c25683e
TG
220 which is otherwise random. This feature depends on ID_NET_NAME_*
221 properties existing for the link, on hardware where these
e2acdb6b 222 properties are not set the generation of a persistent MAC address
1c25683e 223 will fail.</para>
798d3a52
ZJS
224 </listitem>
225 </varlistentry>
226 <varlistentry>
227 <term><literal>random</literal></term>
228 <listitem>
229 <para>If the kernel is using a random MAC address,
230 nothing is done. Otherwise, a new address is randomly
231 generated each time the device appears, typically at
232 boot.</para>
233 </listitem>
234 </varlistentry>
235 </variablelist>
236 </listitem>
237 </varlistentry>
238 <varlistentry>
239 <term><varname>MACAddress=</varname></term>
240 <listitem>
241 <para>The MAC address to use, if no
242 <literal>MACAddressPolicy=</literal>
243 is specified.</para>
244 </listitem>
245 </varlistentry>
246 <varlistentry>
247 <term><varname>NamePolicy=</varname></term>
248 <listitem>
249 <para>An ordered, space-separated list of policies by which
250 the interface name should be set.
251 <literal>NamePolicy</literal> may be disabled by specifying
252 <literal>net.ifnames=0</literal> on the kernel command line.
253 Each of the policies may fail, and the first successful one
254 is used. The name is not set directly, but is exported to
255 udev as the property <literal>ID_NET_NAME</literal>, which
256 is, by default, used by a udev rule to set
257 <literal>NAME</literal>. If the name has already been set by
258 userspace, no renaming is performed. The available policies
259 are:</para>
1ff28eae 260
798d3a52
ZJS
261 <variablelist>
262 <varlistentry>
263 <term><literal>kernel</literal></term>
264 <listitem>
265 <para>If the kernel claims that the name it has set
266 for a device is predictable, then no renaming is
267 performed.</para>
268 </listitem>
269 </varlistentry>
270 <varlistentry>
271 <term><literal>database</literal></term>
272 <listitem>
273 <para>The name is set based on entries in the udev's
274 Hardware Database with the key
275 <literal>ID_NET_NAME_FROM_DATABASE</literal>.
276 </para>
277 </listitem>
278 </varlistentry>
279 <varlistentry>
280 <term><literal>onboard</literal></term>
281 <listitem>
282 <para>The name is set based on information given by
283 the firmware for on-board devices, as exported by the
284 udev property <literal>ID_NET_NAME_ONBOARD</literal>.
285 </para>
286 </listitem>
287 </varlistentry>
288 <varlistentry>
289 <term><literal>slot</literal></term>
290 <listitem>
291 <para>The name is set based on information given by
292 the firmware for hot-plug devices, as exported by the
293 udev property <literal>ID_NET_NAME_SLOT</literal>.
294 </para>
295 </listitem>
296 </varlistentry>
297 <varlistentry>
298 <term><literal>path</literal></term>
299 <listitem>
300 <para>The name is set based on the device's physical
301 location, as exported by the udev property
302 <literal>ID_NET_NAME_PATH</literal>.</para>
303 </listitem>
304 </varlistentry>
305 <varlistentry>
306 <term><literal>mac</literal></term>
307 <listitem>
308 <para>The name is set based on the device's persistent
309 MAC address, as exported by the udev property
310 <literal>ID_NET_NAME_MAC</literal>.</para>
311 </listitem>
312 </varlistentry>
313 </variablelist>
314 </listitem>
315 </varlistentry>
316 <varlistentry>
317 <term><varname>Name=</varname></term>
318 <listitem>
319 <para>The interface name to use in case all the
320 policies specified in
321 <varname>NamePolicy=</varname> fail, or in case
322 <varname>NamePolicy=</varname> is missing or
323 disabled.</para>
324 </listitem>
325 </varlistentry>
326 <varlistentry>
327 <term><varname>MTUBytes=</varname></term>
328 <listitem>
329 <para>The maximum transmission unit in bytes to set for the
330 device. The usual suffixes K, M, G, are supported and are
331 understood to the base of 1024.</para>
332 </listitem>
333 </varlistentry>
334 <varlistentry>
335 <term><varname>BitsPerSecond=</varname></term>
336 <listitem>
337 <para>The speed to set for the device, the value is rounded
338 down to the nearest Mbps. The usual suffixes K, M, G, are
339 supported and are understood to the base of 1000.</para>
340 </listitem>
341 </varlistentry>
342 <varlistentry>
343 <term><varname>Duplex=</varname></term>
344 <listitem>
345 <para>The duplex mode to set for the device. The accepted
346 values are <literal>half</literal> and
347 <literal>full</literal>.</para>
348 </listitem>
349 </varlistentry>
350 <varlistentry>
351 <term><varname>WakeOnLan=</varname></term>
352 <listitem>
353 <para>The Wake-on-LAN policy to set for the device. The
354 supported values are:</para>
1ff28eae 355
798d3a52
ZJS
356 <variablelist>
357 <varlistentry>
358 <term><literal>phy</literal></term>
359 <listitem>
360 <para>Wake on PHY activity.</para>
361 </listitem>
362 </varlistentry>
363 <varlistentry>
364 <term><literal>magic</literal></term>
365 <listitem>
366 <para>Wake on receipt of a magic packet.
367 </para>
368 </listitem>
369 </varlistentry>
370 <varlistentry>
371 <term><literal>off</literal></term>
372 <listitem>
373 <para>Never wake.</para>
374 </listitem>
375 </varlistentry>
376 </variablelist>
377 </listitem>
378 </varlistentry>
379 </variablelist>
380 </refsect1>
1ff28eae 381
798d3a52
ZJS
382 <refsect1>
383 <title>Example</title>
384 <example>
385 <title>/etc/systemd/network/wireless.link</title>
1ff28eae 386
798d3a52 387 <programlisting>[Match]
7abaad1a 388MACAddress=12:34:56:78:9a:bc
389Driver=brcmsmac
390Path=pci-0000:02:00.0-*
391Type=wlan
392Virtualization=no
393Host=my-laptop
394Architecture=x86-64
1ff28eae 395
7abaad1a 396[Link]
397Name=wireless0
398MTUBytes=1450
399BitsPerSecond=10M
400WakeOnLan=magic
401MACAddress=cb:a9:87:65:43:21</programlisting>
798d3a52
ZJS
402 </example>
403 </refsect1>
1ff28eae 404
798d3a52
ZJS
405 <refsect1>
406 <title>See Also</title>
407 <para>
408 <citerefentry>
409 <refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum>
410 </citerefentry>,
411 <citerefentry>
412 <refentrytitle>udevadm</refentrytitle><manvolnum>8</manvolnum>
413 </citerefentry>,
414 <citerefentry>
415 <refentrytitle>systemd.netdev</refentrytitle><manvolnum>5</manvolnum>
416 </citerefentry>,
417 <citerefentry>
418 <refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum>
419 </citerefentry>
420 </para>
421 </refsect1>
1ff28eae
TG
422
423</refentry>