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