]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd.link.xml
network,udev: make MACAddress= in [Match] section take multiple MAC addresses
[thirdparty/systemd.git] / man / systemd.link.xml
CommitLineData
b97e7fab 1<?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
1ff28eae 2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
12b42c76 3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
1ff28eae
TG
4
5<!--
572eb058
ZJS
6 SPDX-License-Identifier: LGPL-2.1+
7
1ff28eae
TG
8 This file is part of systemd.
9
10 Copyright 2014 Tom Gundersen
1ff28eae
TG
11-->
12
13<refentry id="systemd.link">
798d3a52
ZJS
14 <refentryinfo>
15 <title>systemd.link</title>
16 <productname>systemd</productname>
1ff28eae 17
798d3a52
ZJS
18 <authorgroup>
19 <author>
20 <contrib>Developer</contrib>
21 <firstname>Tom</firstname>
22 <surname>Gundersen</surname>
23 </author>
24 </authorgroup>
25 </refentryinfo>
1ff28eae 26
798d3a52
ZJS
27 <refmeta>
28 <refentrytitle>systemd.link</refentrytitle>
29 <manvolnum>5</manvolnum>
30 </refmeta>
1ff28eae 31
798d3a52
ZJS
32 <refnamediv>
33 <refname>systemd.link</refname>
34 <refpurpose>Network device configuration</refpurpose>
35 </refnamediv>
1ff28eae 36
798d3a52
ZJS
37 <refsynopsisdiv>
38 <para><filename><replaceable>link</replaceable>.link</filename></para>
39 </refsynopsisdiv>
1ff28eae 40
798d3a52
ZJS
41 <refsect1>
42 <title>Description</title>
1ff28eae 43
798d3a52
ZJS
44 <para>Network link configuration is performed by the
45 <command>net_setup_link</command> udev builtin.</para>
1ff28eae 46
798d3a52 47 <para>The link files are read from the files located in the system
12b42c76 48 network directory <filename>/usr/lib/systemd/network</filename>,
798d3a52
ZJS
49 the volatile runtime network directory
50 <filename>/run/systemd/network</filename>, and the local
51 administration network directory
12b42c76 52 <filename>/etc/systemd/network</filename>. Link files must have
798d3a52
ZJS
53 the extension <filename>.link</filename>; other extensions are
54 ignored. All link files are collectively sorted and processed in
55 lexical order, regardless of the directories in which they live.
56 However, files with identical filenames replace each other. Files
57 in <filename>/etc</filename> have the highest priority, files in
58 <filename>/run</filename> take precedence over files with the same
12b42c76 59 name in <filename>/usr/lib</filename>. This can be used to
57e27ec0
ZJS
60 override a system-supplied link file with a local file if needed.
61 As a special case, an empty file (file size 0) or symlink with the
a8eaaee7 62 same name pointing to <filename>/dev/null</filename> disables the
57e27ec0 63 configuration file entirely (it is "masked").</para>
1ff28eae 64
798d3a52
ZJS
65 <para>The link file contains a <literal>[Match]</literal> section,
66 which determines if a given link file may be applied to a given
67 device, as well as a <literal>[Link]</literal> section specifying
68 how the device should be configured. The first (in lexical order)
69 of the link files that matches a given device is applied. Note
70 that a default file <filename>99-default.link</filename> is
1b934761 71 shipped by the system. Any user-supplied
798d3a52
ZJS
72 <filename>.link</filename> should hence have a lexically earlier
73 name to be considered at all.</para>
788f37c7
TG
74
75 <para>See
76 <citerefentry><refentrytitle>udevadm</refentrytitle><manvolnum>8</manvolnum></citerefentry>
77 for diagnosing problems with <filename>.link</filename> files.</para>
798d3a52 78 </refsect1>
102bd40e 79
798d3a52
ZJS
80 <refsect1>
81 <title>[Match] Section Options</title>
1ff28eae 82
798d3a52
ZJS
83 <para>A link file is said to match a device if each of the entries
84 in the <literal>[Match]</literal> section matches, or if the
85 section is empty. The following keys are accepted:</para>
1ff28eae 86
798d3a52
ZJS
87 <variablelist class='network-directives'>
88 <varlistentry>
89 <term><varname>MACAddress=</varname></term>
90 <listitem>
91 <para>The hardware address.</para>
92 </listitem>
93 </varlistentry>
94 <varlistentry>
95 <term><varname>OriginalName=</varname></term>
96 <listitem>
5256e00e
TG
97 <para>A whitespace-separated list of shell-style globs matching
98 the device name, as exposed by the udev property
2dd67817 99 "INTERFACE". This cannot be used to match on names that have
5256e00e 100 already been changed from userspace. Caution is advised when matching on
798d3a52
ZJS
101 kernel-assigned names, as they are known to be unstable
102 between reboots.</para>
103 </listitem>
104 </varlistentry>
105 <varlistentry>
106 <term><varname>Path=</varname></term>
107 <listitem>
5256e00e
TG
108 <para>A whitespace-separated list of shell-style globs matching
109 the persistent path, as exposed by the udev property
110 <literal>ID_PATH</literal>.</para>
798d3a52
ZJS
111 </listitem>
112 </varlistentry>
113 <varlistentry>
114 <term><varname>Driver=</varname></term>
115 <listitem>
5256e00e
TG
116 <para>A whitespace-separated list of shell-style globs matching
117 the driver currently bound to the device,
798d3a52
ZJS
118 as exposed by the udev property <literal>DRIVER</literal>
119 of its parent device, or if that is not set, the
120 driver as exposed by <literal>ethtool -i</literal>
121 of the device itself.</para>
122 </listitem>
123 </varlistentry>
124 <varlistentry>
125 <term><varname>Type=</varname></term>
126 <listitem>
5256e00e
TG
127 <para>A whitespace-separated list of shell-style globs matching
128 the device type, as exposed by the udev
798d3a52
ZJS
129 property <literal>DEVTYPE</literal>.</para>
130 </listitem>
131 </varlistentry>
132 <varlistentry>
133 <term><varname>Host=</varname></term>
134 <listitem>
135 <para>Matches against the hostname or machine
136 ID of the host. See <literal>ConditionHost=</literal> in
137 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
138 for details.</para>
139 </listitem>
140 </varlistentry>
141 <varlistentry>
142 <term><varname>Virtualization=</varname></term>
143 <listitem>
144 <para>Checks whether the system is executed in
145 a virtualized environment and optionally test
146 whether it is a specific implementation. See
147 <literal>ConditionVirtualization=</literal> in
148 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
149 for details.</para>
150 </listitem>
151 </varlistentry>
152 <varlistentry>
153 <term><varname>KernelCommandLine=</varname></term>
154 <listitem>
155 <para>Checks whether a specific kernel command line option
156 is set (or if prefixed with the exclamation mark unset). See
157 <literal>ConditionKernelCommandLine=</literal> in
158 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
159 for details.</para>
160 </listitem>
161 </varlistentry>
5022f08a
LP
162 <varlistentry>
163 <term><varname>KernelVersion=</varname></term>
164 <listitem>
165 <para>Checks whether the kernel version (as reported by <command>uname -r</command>) matches a certain
166 expression (or if prefixed with the exclamation mark does not match it). See
167 <literal>ConditionKernelVersion=</literal> in
168 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry> for
169 details.
170 </para>
171 </listitem>
172 </varlistentry>
798d3a52
ZJS
173 <varlistentry>
174 <term><varname>Architecture=</varname></term>
175 <listitem>
176 <para>Checks whether the system is running on a specific
177 architecture. See <literal>ConditionArchitecture=</literal>
178 in
179 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
180 for details.</para>
181 </listitem>
182 </varlistentry>
183 </variablelist>
1ff28eae 184
798d3a52 185 </refsect1>
102bd40e 186
798d3a52
ZJS
187 <refsect1>
188 <title>[Link] Section Options</title>
102bd40e 189
798d3a52
ZJS
190 <para>The <literal>[Link]</literal> section accepts the following
191 keys:</para>
1ff28eae 192
798d3a52
ZJS
193 <variablelist class='network-directives'>
194 <varlistentry>
195 <term><varname>Description=</varname></term>
196 <listitem>
197 <para>A description of the device.</para>
198 </listitem>
199 </varlistentry>
200 <varlistentry>
201 <term><varname>Alias=</varname></term>
202 <listitem>
203 <para>The <literal>ifalias</literal> is set to this
204 value.</para>
205 </listitem>
206 </varlistentry>
207 <varlistentry>
208 <term><varname>MACAddressPolicy=</varname></term>
209 <listitem>
210 <para>The policy by which the MAC address should be set. The
211 available policies are:
212 </para>
1ff28eae 213
798d3a52
ZJS
214 <variablelist>
215 <varlistentry>
216 <term><literal>persistent</literal></term>
217 <listitem>
218 <para>If the hardware has a persistent MAC address, as
219 most hardware should, and if it is used by the kernel,
220 nothing is done. Otherwise, a new MAC address is
221 generated which is guaranteed to be the same on every
222 boot for the given machine and the given device, but
1c25683e 223 which is otherwise random. This feature depends on ID_NET_NAME_*
a8eaaee7 224 properties to exist for the link. On hardware where these
b938cb90 225 properties are not set, the generation of a persistent MAC address
1c25683e 226 will fail.</para>
798d3a52
ZJS
227 </listitem>
228 </varlistentry>
229 <varlistentry>
230 <term><literal>random</literal></term>
231 <listitem>
232 <para>If the kernel is using a random MAC address,
233 nothing is done. Otherwise, a new address is randomly
234 generated each time the device appears, typically at
b938cb90 235 boot. Either way, the random address will have the
2e229e0c
TG
236 <literal>unicast</literal> and
237 <literal>locally administered</literal> bits set.</para>
798d3a52
ZJS
238 </listitem>
239 </varlistentry>
66d3752e
JK
240 <varlistentry>
241 <term><literal>none</literal></term>
242 <listitem>
243 <para>Keeps the MAC address assigned by the kernel.</para>
244 </listitem>
245 </varlistentry>
798d3a52
ZJS
246 </variablelist>
247 </listitem>
248 </varlistentry>
249 <varlistentry>
250 <term><varname>MACAddress=</varname></term>
251 <listitem>
252 <para>The MAC address to use, if no
253 <literal>MACAddressPolicy=</literal>
254 is specified.</para>
255 </listitem>
256 </varlistentry>
257 <varlistentry>
258 <term><varname>NamePolicy=</varname></term>
259 <listitem>
260 <para>An ordered, space-separated list of policies by which
261 the interface name should be set.
262 <literal>NamePolicy</literal> may be disabled by specifying
263 <literal>net.ifnames=0</literal> on the kernel command line.
264 Each of the policies may fail, and the first successful one
265 is used. The name is not set directly, but is exported to
266 udev as the property <literal>ID_NET_NAME</literal>, which
267 is, by default, used by a udev rule to set
268 <literal>NAME</literal>. If the name has already been set by
269 userspace, no renaming is performed. The available policies
270 are:</para>
1ff28eae 271
798d3a52
ZJS
272 <variablelist>
273 <varlistentry>
274 <term><literal>kernel</literal></term>
275 <listitem>
276 <para>If the kernel claims that the name it has set
277 for a device is predictable, then no renaming is
278 performed.</para>
279 </listitem>
280 </varlistentry>
281 <varlistentry>
282 <term><literal>database</literal></term>
283 <listitem>
284 <para>The name is set based on entries in the udev's
285 Hardware Database with the key
286 <literal>ID_NET_NAME_FROM_DATABASE</literal>.
287 </para>
288 </listitem>
289 </varlistentry>
290 <varlistentry>
291 <term><literal>onboard</literal></term>
292 <listitem>
293 <para>The name is set based on information given by
294 the firmware for on-board devices, as exported by the
295 udev property <literal>ID_NET_NAME_ONBOARD</literal>.
296 </para>
297 </listitem>
298 </varlistentry>
299 <varlistentry>
300 <term><literal>slot</literal></term>
301 <listitem>
302 <para>The name is set based on information given by
303 the firmware for hot-plug devices, as exported by the
304 udev property <literal>ID_NET_NAME_SLOT</literal>.
305 </para>
306 </listitem>
307 </varlistentry>
308 <varlistentry>
309 <term><literal>path</literal></term>
310 <listitem>
311 <para>The name is set based on the device's physical
312 location, as exported by the udev property
313 <literal>ID_NET_NAME_PATH</literal>.</para>
314 </listitem>
315 </varlistentry>
316 <varlistentry>
317 <term><literal>mac</literal></term>
318 <listitem>
319 <para>The name is set based on the device's persistent
320 MAC address, as exported by the udev property
321 <literal>ID_NET_NAME_MAC</literal>.</para>
322 </listitem>
323 </varlistentry>
324 </variablelist>
325 </listitem>
326 </varlistentry>
327 <varlistentry>
328 <term><varname>Name=</varname></term>
329 <listitem>
330 <para>The interface name to use in case all the
331 policies specified in
332 <varname>NamePolicy=</varname> fail, or in case
333 <varname>NamePolicy=</varname> is missing or
334 disabled.</para>
1b934761
ZJS
335
336 <para>Note that specifying a name that the kernel might use for another
337 interface (for example <literal>eth0</literal>) is dangerous because the
338 name assignment done by udev will race with the assignment done by the
339 kernel, and only one interface may use the name. Depending on the order of
340 operations, either udev or the kernel will win, making the naming
341 unpredictable. It is best to use some different prefix, for example
342 <literal>internal0</literal>/<literal>external0</literal> or
343 <literal>lan0</literal>/<literal>lan1</literal>/<literal>lan3</literal>.
344 </para>
798d3a52
ZJS
345 </listitem>
346 </varlistentry>
347 <varlistentry>
348 <term><varname>MTUBytes=</varname></term>
349 <listitem>
350 <para>The maximum transmission unit in bytes to set for the
351 device. The usual suffixes K, M, G, are supported and are
352 understood to the base of 1024.</para>
353 </listitem>
354 </varlistentry>
355 <varlistentry>
356 <term><varname>BitsPerSecond=</varname></term>
357 <listitem>
358 <para>The speed to set for the device, the value is rounded
359 down to the nearest Mbps. The usual suffixes K, M, G, are
360 supported and are understood to the base of 1000.</para>
361 </listitem>
362 </varlistentry>
363 <varlistentry>
364 <term><varname>Duplex=</varname></term>
365 <listitem>
366 <para>The duplex mode to set for the device. The accepted
367 values are <literal>half</literal> and
368 <literal>full</literal>.</para>
369 </listitem>
370 </varlistentry>
a39f92d3
SS
371 <varlistentry>
372 <term><varname>AutoNegotiation=</varname></term>
373 <listitem>
374 <para>Enables or disables automatic negotiation of transmission parameters.
375 Autonegotiation is a procedure by which two connected ethernet devices choose
376 common transmission parameters, such as speed, duplex mode, and flow control.
377 Takes a boolean value. Unset by default, which means that the kernel default
378 will be used.</para>
379
380 <para>Note that if autonegotiation is enabled, speed and duplex settings are
381 read-only. If autonegotation is disabled, speed and duplex settings are writable
382 if the driver supports multiple link modes.</para>
383 </listitem>
384 </varlistentry>
798d3a52
ZJS
385 <varlistentry>
386 <term><varname>WakeOnLan=</varname></term>
387 <listitem>
388 <para>The Wake-on-LAN policy to set for the device. The
389 supported values are:</para>
1ff28eae 390
798d3a52
ZJS
391 <variablelist>
392 <varlistentry>
393 <term><literal>phy</literal></term>
394 <listitem>
395 <para>Wake on PHY activity.</para>
396 </listitem>
397 </varlistentry>
617da14c
SS
398 <varlistentry>
399 <term><literal>unicast</literal></term>
400 <listitem>
401 <para>Wake on unicast messages.</para>
402 </listitem>
403 </varlistentry>
404 <varlistentry>
405 <term><literal>multicast</literal></term>
406 <listitem>
407 <para>Wake on multicast messages.</para>
408 </listitem>
409 </varlistentry>
410 <varlistentry>
411 <term><literal>broadcast</literal></term>
412 <listitem>
413 <para>Wake on broadcast messages.</para>
414 </listitem>
415 </varlistentry>
416 <varlistentry>
417 <term><literal>arp</literal></term>
418 <listitem>
419 <para>Wake on ARP.</para>
420 </listitem>
421 </varlistentry>
798d3a52
ZJS
422 <varlistentry>
423 <term><literal>magic</literal></term>
424 <listitem>
425 <para>Wake on receipt of a magic packet.
426 </para>
427 </listitem>
428 </varlistentry>
617da14c
SS
429 <varlistentry>
430 <term><literal>secureon</literal></term>
431 <listitem>
432 <para>Enable secureon(tm) password for MagicPacket(tm).
433 </para>
434 </listitem>
435 </varlistentry>
798d3a52
ZJS
436 <varlistentry>
437 <term><literal>off</literal></term>
438 <listitem>
439 <para>Never wake.</para>
440 </listitem>
441 </varlistentry>
442 </variablelist>
c605bd00
ZJS
443
444 <para>Defaults to <literal>off</literal>.</para>
798d3a52
ZJS
445 </listitem>
446 </varlistentry>
593022fa
SS
447 <varlistentry>
448 <term><varname>Port=</varname></term>
449 <listitem>
450 <para>The port option is used to select the device port. The
451 supported values are:</para>
452
453 <variablelist>
454 <varlistentry>
455 <term><literal>tp</literal></term>
456 <listitem>
457 <para>An Ethernet interface using Twisted-Pair cable as the medium.</para>
458 </listitem>
459 </varlistentry>
460 <varlistentry>
461 <term><literal>aui</literal></term>
462 <listitem>
463 <para>Attachment Unit Interface (AUI). Normally used with hubs.
464 </para>
465 </listitem>
466 </varlistentry>
467 <varlistentry>
468 <term><literal>bnc</literal></term>
469 <listitem>
470 <para>An Ethernet interface using BNC connectors and co-axial cable.</para>
471 </listitem>
472 </varlistentry>
473 <varlistentry>
474 <term><literal>mii</literal></term>
475 <listitem>
476 <para>An Ethernet interface using a Media Independent Interface (MII).</para>
477 </listitem>
478 </varlistentry>
479 <varlistentry>
480 <term><literal>fibre</literal></term>
481 <listitem>
482 <para>An Ethernet interface using Optical Fibre as the medium.</para>
483 </listitem>
484 </varlistentry>
485 </variablelist>
486 </listitem>
487 </varlistentry>
50725d10
SS
488 <varlistentry>
489 <term><varname>TCPSegmentationOffload=</varname></term>
490 <listitem>
491 <para>The TCP Segmentation Offload (TSO) when true enables
492 TCP segmentation offload. Takes a boolean value.
493 Defaults to "unset".</para>
494 </listitem>
ffa69a04
SS
495 </varlistentry>
496 <varlistentry>
497 <term><varname>TCP6SegmentationOffload=</varname></term>
498 <listitem>
499 <para>The TCP6 Segmentation Offload (tx-tcp6-segmentation) when true enables
500 TCP6 segmentation offload. Takes a boolean value.
501 Defaults to "unset".</para>
502 </listitem>
50725d10
SS
503 </varlistentry>
504 <varlistentry>
505 <term><varname>GenericSegmentationOffload=</varname></term>
506 <listitem>
507 <para>The Generic Segmentation Offload (GSO) when true enables
508 generic segmentation offload. Takes a boolean value.
509 Defaults to "unset".</para>
510 </listitem>
511 </varlistentry>
f7ea90fb
SS
512 <varlistentry>
513 <term><varname>GenericReceiveOffload=</varname></term>
514 <listitem>
515 <para>The Generic Receive Offload (GRO) when true enables
516 generic receive offload. Takes a boolean value.
517 Defaults to "unset".</para>
518 </listitem>
519 </varlistentry>
520 <varlistentry>
521 <term><varname>LargeReceiveOffload=</varname></term>
522 <listitem>
523 <para>The Large Receive Offload (LRO) when true enables
524 large receive offload. Takes a boolean value.
525 Defaults to "unset".</para>
526 </listitem>
527 </varlistentry>
5f945202
SS
528 <varlistentry>
529 <term><varname>RxChannels=</varname></term>
530 <listitem>
531 <para>Sets the number of receive channels (a number between 1 and 4294967295) .</para>
532 </listitem>
533 </varlistentry>
534 <varlistentry>
535 <term><varname>TxChannels=</varname></term>
536 <listitem>
537 <para>Sets the number of transmit channels (a number between 1 and 4294967295).</para>
538 </listitem>
539 </varlistentry>
540 <varlistentry>
541 <term><varname>OtherChannels=</varname></term>
542 <listitem>
543 <para>Sets the number of other channels (a number between 1 and 4294967295).</para>
544 </listitem>
545 </varlistentry>
546 <varlistentry>
547 <term><varname>CombinedChannels=</varname></term>
548 <listitem>
549 <para>Sets the number of combined set channels (a number between 1 and 4294967295).</para>
550 </listitem>
551 </varlistentry>
798d3a52
ZJS
552 </variablelist>
553 </refsect1>
1ff28eae 554
798d3a52 555 <refsect1>
b97e7fab
LP
556 <title>Examples</title>
557
558 <example>
559 <title>/usr/lib/systemd/network/99-default.link</title>
560
561 <para>The link file <filename>99-default.link</filename> that is
562 shipped with systemd defines the default naming policy for
563 links.</para>
564
565 <programlisting>[Link]
566NamePolicy=kernel database onboard slot path
567MACAddressPolicy=persistent</programlisting>
568 </example>
569
570 <example>
571 <title>/etc/systemd/network/10-dmz.link</title>
572
573 <para>This example assigns the fixed name
574 <literal>dmz0</literal> to the interface with the MAC address
575 00:a0:de:63:7a:e6:</para>
576
577 <programlisting>[Match]
578MACAddress=00:a0:de:63:7a:e6
579
580[Link]
581Name=dmz0</programlisting>
582 </example>
583
584 <example>
585 <title>/etc/systemd/network/10-internet.link</title>
586
587 <para>This example assigns the fixed name
588 <literal>internet0</literal> to the interface with the device
589 path <literal>pci-0000:00:1a.0-*</literal>:</para>
590
591 <programlisting>[Match]
592Path=pci-0000:00:1a.0-*
593
594[Link]
595Name=internet0</programlisting>
596 </example>
597
798d3a52 598 <example>
6c1695be 599 <title>/etc/systemd/network/25-wireless.link</title>
1ff28eae 600
b97e7fab
LP
601 <para>Here's an overly complex example that shows the use of a large number of [Match] and [Link] settings.</para>
602
798d3a52 603 <programlisting>[Match]
7abaad1a 604MACAddress=12:34:56:78:9a:bc
605Driver=brcmsmac
606Path=pci-0000:02:00.0-*
607Type=wlan
608Virtualization=no
609Host=my-laptop
610Architecture=x86-64
1ff28eae 611
7abaad1a 612[Link]
613Name=wireless0
614MTUBytes=1450
615BitsPerSecond=10M
616WakeOnLan=magic
617MACAddress=cb:a9:87:65:43:21</programlisting>
798d3a52
ZJS
618 </example>
619 </refsect1>
1ff28eae 620
798d3a52
ZJS
621 <refsect1>
622 <title>See Also</title>
623 <para>
624 <citerefentry>
625 <refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum>
626 </citerefentry>,
627 <citerefentry>
628 <refentrytitle>udevadm</refentrytitle><manvolnum>8</manvolnum>
629 </citerefentry>,
630 <citerefentry>
631 <refentrytitle>systemd.netdev</refentrytitle><manvolnum>5</manvolnum>
632 </citerefentry>,
633 <citerefentry>
634 <refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum>
635 </citerefentry>
636 </para>
637 </refsect1>
1ff28eae
TG
638
639</refentry>