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