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">
6 SPDX-License-Identifier: LGPL-2.1+
8 Copyright © 2014 Tom Gundersen
11 <refentry id=
"systemd.link">
13 <title>systemd.link
</title>
14 <productname>systemd
</productname>
18 <refentrytitle>systemd.link
</refentrytitle>
19 <manvolnum>5</manvolnum>
23 <refname>systemd.link
</refname>
24 <refpurpose>Network device configuration
</refpurpose>
28 <para><filename><replaceable>link
</replaceable>.link
</filename></para>
32 <title>Description
</title>
34 <para>Network link configuration is performed by the
35 <command>net_setup_link
</command> udev builtin.
</para>
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>
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>
66 <citerefentry><refentrytitle>udevadm
</refentrytitle><manvolnum>8</manvolnum></citerefentry>
67 for diagnosing problems with
<filename>.link
</filename> files.
</para>
71 <title>[Match] Section Options
</title>
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>
77 <variablelist class='network-directives'
>
79 <term><varname>MACAddress=
</varname></term>
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>
86 <programlisting>MACAddress=
01:
23:
45:
67:
89:ab
00-
11-
22-
33-
44-
55 AABB.CCDD.EEFF
</programlisting></para>
90 <term><varname>OriginalName=
</varname></term>
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>
101 <term><varname>Path=
</varname></term>
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>
109 <term><varname>Driver=
</varname></term>
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>
120 <term><varname>Type=
</varname></term>
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>
128 <term><varname>Host=
</varname></term>
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>
137 <term><varname>Virtualization=
</varname></term>
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>
148 <term><varname>KernelCommandLine=
</varname></term>
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>
158 <term><varname>KernelVersion=
</varname></term>
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
169 <term><varname>Architecture=
</varname></term>
171 <para>Checks whether the system is running on a specific
172 architecture. See
<literal>ConditionArchitecture=
</literal>
174 <citerefentry><refentrytitle>systemd.unit
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
183 <title>[Link] Section Options
</title>
185 <para>The
<literal>[Link]
</literal> section accepts the following
188 <variablelist class='network-directives'
>
190 <term><varname>Description=
</varname></term>
192 <para>A description of the device.
</para>
196 <term><varname>Alias=
</varname></term>
198 <para>The
<literal>ifalias
</literal> is set to this
203 <term><varname>MACAddressPolicy=
</varname></term>
205 <para>The policy by which the MAC address should be set. The
206 available policies are:
211 <term><literal>persistent
</literal></term>
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
225 <term><literal>random
</literal></term>
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>
236 <term><literal>none
</literal></term>
238 <para>Keeps the MAC address assigned by the kernel.
</para>
245 <term><varname>MACAddress=
</varname></term>
247 <para>The MAC address to use, if no
248 <literal>MACAddressPolicy=
</literal>
253 <term><varname>NamePolicy=
</varname></term>
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
269 <term><literal>kernel
</literal></term>
271 <para>If the kernel claims that the name it has set
272 for a device is predictable, then no renaming is
277 <term><literal>database
</literal></term>
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>.
286 <term><literal>onboard
</literal></term>
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>.
295 <term><literal>slot
</literal></term>
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>.
304 <term><literal>path
</literal></term>
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>
312 <term><literal>mac
</literal></term>
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>
323 <term><varname>Name=
</varname></term>
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
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>.
343 <term><varname>MTUBytes=
</varname></term>
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>
351 <term><varname>BitsPerSecond=
</varname></term>
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>
359 <term><varname>Duplex=
</varname></term>
361 <para>The duplex mode to set for the device. The accepted
362 values are
<literal>half
</literal> and
363 <literal>full
</literal>.
</para>
367 <term><varname>AutoNegotiation=
</varname></term>
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
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>
381 <term><varname>WakeOnLan=
</varname></term>
383 <para>The Wake-on-LAN policy to set for the device. The
384 supported values are:
</para>
388 <term><literal>phy
</literal></term>
390 <para>Wake on PHY activity.
</para>
394 <term><literal>unicast
</literal></term>
396 <para>Wake on unicast messages.
</para>
400 <term><literal>multicast
</literal></term>
402 <para>Wake on multicast messages.
</para>
406 <term><literal>broadcast
</literal></term>
408 <para>Wake on broadcast messages.
</para>
412 <term><literal>arp
</literal></term>
414 <para>Wake on ARP.
</para>
418 <term><literal>magic
</literal></term>
420 <para>Wake on receipt of a magic packet.
425 <term><literal>secureon
</literal></term>
427 <para>Enable secureon(tm) password for MagicPacket(tm).
432 <term><literal>off
</literal></term>
434 <para>Never wake.
</para>
439 <para>Defaults to
<literal>off
</literal>.
</para>
443 <term><varname>Port=
</varname></term>
445 <para>The port option is used to select the device port. The
446 supported values are:
</para>
450 <term><literal>tp
</literal></term>
452 <para>An Ethernet interface using Twisted-Pair cable as the medium.
</para>
456 <term><literal>aui
</literal></term>
458 <para>Attachment Unit Interface (AUI). Normally used with hubs.
463 <term><literal>bnc
</literal></term>
465 <para>An Ethernet interface using BNC connectors and co-axial cable.
</para>
469 <term><literal>mii
</literal></term>
471 <para>An Ethernet interface using a Media Independent Interface (MII).
</para>
475 <term><literal>fibre
</literal></term>
477 <para>An Ethernet interface using Optical Fibre as the medium.
</para>
484 <term><varname>TCPSegmentationOffload=
</varname></term>
486 <para>The TCP Segmentation Offload (TSO) when true enables
487 TCP segmentation offload. Takes a boolean value.
488 Defaults to
"unset".
</para>
492 <term><varname>TCP6SegmentationOffload=
</varname></term>
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>
500 <term><varname>GenericSegmentationOffload=
</varname></term>
502 <para>The Generic Segmentation Offload (GSO) when true enables
503 generic segmentation offload. Takes a boolean value.
504 Defaults to
"unset".
</para>
508 <term><varname>GenericReceiveOffload=
</varname></term>
510 <para>The Generic Receive Offload (GRO) when true enables
511 generic receive offload. Takes a boolean value.
512 Defaults to
"unset".
</para>
516 <term><varname>LargeReceiveOffload=
</varname></term>
518 <para>The Large Receive Offload (LRO) when true enables
519 large receive offload. Takes a boolean value.
520 Defaults to
"unset".
</para>
524 <term><varname>RxChannels=
</varname></term>
526 <para>Sets the number of receive channels (a number between
1 and
4294967295) .
</para>
530 <term><varname>TxChannels=
</varname></term>
532 <para>Sets the number of transmit channels (a number between
1 and
4294967295).
</para>
536 <term><varname>OtherChannels=
</varname></term>
538 <para>Sets the number of other channels (a number between
1 and
4294967295).
</para>
542 <term><varname>CombinedChannels=
</varname></term>
544 <para>Sets the number of combined set channels (a number between
1 and
4294967295).
</para>
551 <title>Examples
</title>
554 <title>/usr/lib/systemd/network/
99-default.link
</title>
556 <para>The link file
<filename>99-default.link
</filename> that is
557 shipped with systemd defines the default naming policy for
560 <programlisting>[Link]
561 NamePolicy=kernel database onboard slot path
562 MACAddressPolicy=persistent
</programlisting>
566 <title>/etc/systemd/network/
10-dmz.link
</title>
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>
572 <programlisting>[Match]
573 MACAddress=
00:a0:de:
63:
7a:e6
576 Name=dmz0
</programlisting>
580 <title>/etc/systemd/network/
10-internet.link
</title>
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>
586 <programlisting>[Match]
587 Path=pci-
0000:
00:
1a
.0-*
590 Name=internet0
</programlisting>
594 <title>/etc/systemd/network/
25-wireless.link
</title>
596 <para>Here's an overly complex example that shows the use of a large number of [Match] and [Link] settings.
</para>
598 <programlisting>[Match]
599 MACAddress=
12:
34:
56:
78:
9a:bc
601 Path=pci-
0000:
02:
00.0-*
612 MACAddress=cb:a9:
87:
65:
43:
21</programlisting>
617 <title>See Also
</title>
620 <refentrytitle>systemd-udevd.service
</refentrytitle><manvolnum>8</manvolnum>
623 <refentrytitle>udevadm
</refentrytitle><manvolnum>8</manvolnum>
626 <refentrytitle>systemd.netdev
</refentrytitle><manvolnum>5</manvolnum>
629 <refentrytitle>systemd.network
</refentrytitle><manvolnum>5</manvolnum>