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