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