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+
9 <refentry id=
"systemd.link">
11 <title>systemd.link
</title>
12 <productname>systemd
</productname>
16 <refentrytitle>systemd.link
</refentrytitle>
17 <manvolnum>5</manvolnum>
21 <refname>systemd.link
</refname>
22 <refpurpose>Network device configuration
</refpurpose>
26 <para><filename><replaceable>link
</replaceable>.link
</filename></para>
30 <title>Description
</title>
32 <para>Network link configuration is performed by the
33 <command>net_setup_link
</command> udev builtin.
</para>
35 <para>The link files are read from the files located in the system
36 network directory
<filename>/usr/lib/systemd/network
</filename>,
37 the volatile runtime network directory
38 <filename>/run/systemd/network
</filename>, and the local
39 administration network directory
40 <filename>/etc/systemd/network
</filename>. Link files must have
41 the extension
<filename>.link
</filename>; other extensions are
42 ignored. All link files are collectively sorted and processed in
43 lexical order, regardless of the directories in which they live.
44 However, files with identical filenames replace each other. Files
45 in
<filename>/etc
</filename> have the highest priority, files in
46 <filename>/run
</filename> take precedence over files with the same
47 name in
<filename>/usr/lib
</filename>. This can be used to
48 override a system-supplied link file with a local file if needed.
49 As a special case, an empty file (file size
0) or symlink with the
50 same name pointing to
<filename>/dev/null
</filename> disables the
51 configuration file entirely (it is
"masked").
</para>
53 <para>The link file contains a [Match] section, which determines if a given link file may be applied to a
54 given device, as well as a [Link] section specifying how the device should be configured. The first (in
55 lexical order) of the link files that matches a given device is applied. Note that a default file
56 <filename>99-default.link
</filename> is shipped by the system. Any user-supplied
57 <filename>.link
</filename> should hence have a lexically earlier name to be considered at all.
</para>
59 <para>See
<citerefentry><refentrytitle>udevadm
</refentrytitle><manvolnum>8</manvolnum></citerefentry> for
60 diagnosing problems with
<filename>.link
</filename> files.
</para>
64 <title>[Match] Section Options
</title>
66 <para>A link file is said to match a device if each of the entries in the [Match] section matches, or if
67 the section is empty. The following keys are accepted:
</para>
69 <variablelist class='network-directives'
>
71 <term><varname>MACAddress=
</varname></term>
73 <para>A whitespace-separated list of hardware addresses. Use full colon-, hyphen- or dot-delimited hexadecimal. See the example below.
74 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
75 of hardware addresses defined prior to this is reset.
</para>
78 <programlisting>MACAddress=
01:
23:
45:
67:
89:ab
00-
11-
22-
33-
44-
55 AABB.CCDD.EEFF
</programlisting></para>
82 <term><varname>OriginalName=
</varname></term>
84 <para>A whitespace-separated list of shell-style globs matching
85 the device name, as exposed by the udev property
86 "INTERFACE". This cannot be used to match on names that have
87 already been changed from userspace. Caution is advised when matching on
88 kernel-assigned names, as they are known to be unstable
89 between reboots.
</para>
93 <term><varname>Path=
</varname></term>
95 <para>A whitespace-separated list of shell-style globs matching
96 the persistent path, as exposed by the udev property
97 <varname>ID_PATH
</varname>.
</para>
101 <term><varname>Driver=
</varname></term>
103 <para>A whitespace-separated list of shell-style globs matching the driver currently bound to the
104 device, as exposed by the udev property
<varname>DRIVER
</varname> of its parent device, or if that
105 is not set, the driver as exposed by
<command>ethtool -i
</command> of the device itself.
</para>
109 <term><varname>Type=
</varname></term>
111 <para>A whitespace-separated list of shell-style globs matching
112 the device type, as exposed by the udev
113 property
<varname>DEVTYPE
</varname>.
</para>
117 <term><varname>Host=
</varname></term>
119 <para>Matches against the hostname or machine
120 ID of the host. See
<varname>ConditionHost=
</varname> in
121 <citerefentry><refentrytitle>systemd.unit
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
126 <term><varname>Virtualization=
</varname></term>
128 <para>Checks whether the system is executed in
129 a virtualized environment and optionally test
130 whether it is a specific implementation. See
131 <varname>ConditionVirtualization=
</varname> in
132 <citerefentry><refentrytitle>systemd.unit
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
137 <term><varname>KernelCommandLine=
</varname></term>
139 <para>Checks whether a specific kernel command line option
140 is set (or if prefixed with the exclamation mark unset). See
141 <varname>ConditionKernelCommandLine=
</varname> in
142 <citerefentry><refentrytitle>systemd.unit
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
147 <term><varname>KernelVersion=
</varname></term>
149 <para>Checks whether the kernel version (as reported by
<command>uname -r
</command>) matches a certain
150 expression (or if prefixed with the exclamation mark does not match it). See
151 <varname>ConditionKernelVersion=
</varname> in
152 <citerefentry><refentrytitle>systemd.unit
</refentrytitle><manvolnum>5</manvolnum></citerefentry> for
158 <term><varname>Architecture=
</varname></term>
160 <para>Checks whether the system is running on a specific
161 architecture. See
<varname>ConditionArchitecture=
</varname>
163 <citerefentry><refentrytitle>systemd.unit
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
172 <title>[Link] Section Options
</title>
174 <para>The [Link] section accepts the following
177 <variablelist class='network-directives'
>
179 <term><varname>Description=
</varname></term>
181 <para>A description of the device.
</para>
185 <term><varname>Alias=
</varname></term>
187 <para>The
<varname>ifalias
</varname> interface property is set to this value.
</para>
191 <term><varname>MACAddressPolicy=
</varname></term>
193 <para>The policy by which the MAC address should be set. The
194 available policies are:
199 <term><option>persistent
</option></term>
201 <para>If the hardware has a persistent MAC address, as
202 most hardware should, and if it is used by the kernel,
203 nothing is done. Otherwise, a new MAC address is
204 generated which is guaranteed to be the same on every
205 boot for the given machine and the given device, but
206 which is otherwise random. This feature depends on ID_NET_NAME_*
207 properties to exist for the link. On hardware where these
208 properties are not set, the generation of a persistent MAC address
213 <term><option>random
</option></term>
215 <para>If the kernel is using a random MAC address,
216 nothing is done. Otherwise, a new address is randomly
217 generated each time the device appears, typically at
218 boot. Either way, the random address will have the
219 <literal>unicast
</literal> and
220 <literal>locally administered
</literal> bits set.
</para>
224 <term><option>none
</option></term>
226 <para>Keeps the MAC address assigned by the kernel.
</para>
233 <term><varname>MACAddress=
</varname></term>
235 <para>The MAC address to use, if no
236 <varname>MACAddressPolicy=
</varname>
241 <term><varname>NamePolicy=
</varname></term>
243 <para>An ordered, space-separated list of policies by which the interface name should be set.
244 <varname>NamePolicy=
</varname> may be disabled by specifying
<option>net.ifnames=
0</option> on the
245 kernel command line. Each of the policies may fail, and the first successful one is used. The name
246 is not set directly, but is exported to udev as the property
<option>ID_NET_NAME
</option>, which
247 is, by default, used by a udev rule to set
<varname>NAME
</varname>. The available policies are:
252 <term><option>kernel
</option></term>
254 <para>If the kernel claims that the name it has set
255 for a device is predictable, then no renaming is
260 <term><option>database
</option></term>
262 <para>The name is set based on entries in the udev's
263 Hardware Database with the key
264 <varname>ID_NET_NAME_FROM_DATABASE
</varname>.
269 <term><option>onboard
</option></term>
271 <para>The name is set based on information given by
272 the firmware for on-board devices, as exported by the
273 udev property
<varname>ID_NET_NAME_ONBOARD
</varname>.
278 <term><option>slot
</option></term>
280 <para>The name is set based on information given by
281 the firmware for hot-plug devices, as exported by the
282 udev property
<varname>ID_NET_NAME_SLOT
</varname>.
287 <term><option>path
</option></term>
289 <para>The name is set based on the device's physical
290 location, as exported by the udev property
291 <varname>ID_NET_NAME_PATH
</varname>.
</para>
295 <term><option>mac
</option></term>
297 <para>The name is set based on the device's persistent
298 MAC address, as exported by the udev property
299 <varname>ID_NET_NAME_MAC
</varname>.
</para>
303 <term><option>keep
</option></term>
305 <para>If the device already had a name given by userspace (as part of creation of the device
306 or a rename), keep it.
</para>
313 <term><varname>Name=
</varname></term>
315 <para>The interface name to use in case all the
316 policies specified in
317 <varname>NamePolicy=
</varname> fail, or in case
318 <varname>NamePolicy=
</varname> is missing or
321 <para>Note that specifying a name that the kernel might use for another
322 interface (for example
<literal>eth0
</literal>) is dangerous because the
323 name assignment done by udev will race with the assignment done by the
324 kernel, and only one interface may use the name. Depending on the order of
325 operations, either udev or the kernel will win, making the naming
326 unpredictable. It is best to use some different prefix, for example
327 <literal>internal0
</literal>/
<literal>external0
</literal> or
328 <literal>lan0
</literal>/
<literal>lan1
</literal>/
<literal>lan3
</literal>.
333 <term><varname>MTUBytes=
</varname></term>
335 <para>The maximum transmission unit in bytes to set for the
336 device. The usual suffixes K, M, G, are supported and are
337 understood to the base of
1024.
</para>
341 <term><varname>BitsPerSecond=
</varname></term>
343 <para>The speed to set for the device, the value is rounded
344 down to the nearest Mbps. The usual suffixes K, M, G, are
345 supported and are understood to the base of
1000.
</para>
349 <term><varname>Duplex=
</varname></term>
351 <para>The duplex mode to set for the device. The accepted values are
<option>half
</option> and
352 <option>full
</option>.
</para>
356 <term><varname>AutoNegotiation=
</varname></term>
358 <para>Takes a boolean. If set to yes, automatic negotiation of transmission parameters is enabled.
359 Autonegotiation is a procedure by which two connected ethernet devices choose
360 common transmission parameters, such as speed, duplex mode, and flow control.
361 When unset, the kernel's default will be used.
</para>
363 <para>Note that if autonegotiation is enabled, speed and duplex settings are
364 read-only. If autonegotation is disabled, speed and duplex settings are writable
365 if the driver supports multiple link modes.
</para>
369 <term><varname>WakeOnLan=
</varname></term>
371 <para>The Wake-on-LAN policy to set for the device. The
372 supported values are:
</para>
376 <term><option>phy
</option></term>
378 <para>Wake on PHY activity.
</para>
382 <term><option>unicast
</option></term>
384 <para>Wake on unicast messages.
</para>
388 <term><option>multicast
</option></term>
390 <para>Wake on multicast messages.
</para>
394 <term><option>broadcast
</option></term>
396 <para>Wake on broadcast messages.
</para>
400 <term><option>arp
</option></term>
402 <para>Wake on ARP.
</para>
406 <term><option>magic
</option></term>
408 <para>Wake on receipt of a magic packet.
413 <term><option>secureon
</option></term>
415 <para>Enable secureon(tm) password for MagicPacket(tm).
420 <term><option>off
</option></term>
422 <para>Never wake.
</para>
427 <para>Defaults to
<option>off
</option>.
</para>
431 <term><varname>Port=
</varname></term>
433 <para>The port option is used to select the device port. The
434 supported values are:
</para>
438 <term><option>tp
</option></term>
440 <para>An Ethernet interface using Twisted-Pair cable as the medium.
</para>
444 <term><option>aui
</option></term>
446 <para>Attachment Unit Interface (AUI). Normally used with hubs.
451 <term><option>bnc
</option></term>
453 <para>An Ethernet interface using BNC connectors and co-axial cable.
</para>
457 <term><option>mii
</option></term>
459 <para>An Ethernet interface using a Media Independent Interface (MII).
</para>
463 <term><option>fibre
</option></term>
465 <para>An Ethernet interface using Optical Fibre as the medium.
</para>
472 <term><varname>Advertise=
</varname></term>
474 <para>This sets what speeds and duplex modes of operation are advertised for auto-negotiation.
475 This implies
<literal>AutoNegotiation=yes
</literal>. The supported values are:
478 <title>Supported advertise values
</title>
480 <colspec colname='Advertise'
/>
481 <colspec colname='Speed'
/>
482 <colspec colname='Duplex Mode'
/>
485 <entry>Advertise
</entry>
486 <entry>Speed (Mbps)
</entry>
487 <entry>Duplex Mode
</entry>
490 <row><entry><option>10baset-half
</option></entry>
491 <entry>10</entry><entry>half
</entry></row>
493 <row><entry><option>10baset-full
</option></entry>
494 <entry>10</entry><entry>full
</entry></row>
496 <row><entry><option>100baset-half
</option></entry>
497 <entry>100</entry><entry>half
</entry></row>
499 <row><entry><option>100baset-full
</option></entry>
500 <entry>100</entry><entry>full
</entry></row>
502 <row><entry><option>1000baset-half
</option></entry>
503 <entry>1000</entry><entry>half
</entry></row>
505 <row><entry><option>1000baset-full
</option></entry>
506 <entry>1000</entry><entry>full
</entry></row>
508 <row><entry><option>10000baset-full
</option></entry>
509 <entry>10000</entry><entry>full
</entry></row>
511 <row><entry><option>2500basex-full
</option></entry>
512 <entry>2500</entry><entry>full
</entry></row>
514 <row><entry><option>1000basekx-full
</option></entry>
515 <entry>1000</entry><entry>full
</entry></row>
517 <row><entry><option>10000basekx4-full
</option></entry>
518 <entry>10000</entry><entry>full
</entry></row>
520 <row><entry><option>10000basekr-full
</option></entry>
521 <entry>10000</entry><entry>full
</entry></row>
523 <row><entry><option>10000baser-fec
</option></entry>
524 <entry>10000</entry><entry>full
</entry></row>
526 <row><entry><option>20000basemld2-full
</option></entry>
527 <entry>20000</entry><entry>full
</entry></row>
529 <row><entry><option>20000basekr2-full
</option></entry>
530 <entry>20000</entry><entry>full
</entry></row>
535 By default this is unset, i.e. all possible modes will be advertised.
536 This option may be specified more than once, in which case all specified speeds and modes are advertised.
537 If the empty string is assigned to this option, the list is reset, and all prior assignments have no effect.
542 <term><varname>TCPSegmentationOffload=
</varname></term>
544 <para>Takes a boolean. If set to true, the TCP Segmentation Offload (TSO) is enabled.
545 When unset, the kernel's default will be used.
</para>
549 <term><varname>TCP6SegmentationOffload=
</varname></term>
551 <para>Takes a boolean. If set to true, the TCP6 Segmentation Offload (tx-tcp6-segmentation) is enabled.
552 When unset, the kernel's default will be used.
</para>
556 <term><varname>GenericSegmentationOffload=
</varname></term>
558 <para>Takes a boolean. If set to true, the Generic Segmentation Offload (GSO) is enabled.
559 When unset, the kernel's default will be used.
</para>
563 <term><varname>GenericReceiveOffload=
</varname></term>
565 <para>Takes a boolean. If set to true, the Generic Receive Offload (GRO) is enabled.
566 When unset, the kernel's default will be used.
</para>
570 <term><varname>LargeReceiveOffload=
</varname></term>
572 <para>Takes a boolean. If set to true, the Large Receive Offload (LRO) is enabled.
573 When unset, the kernel's default will be used.
</para>
577 <term><varname>RxChannels=
</varname></term>
579 <para>Sets the number of receive channels (a number between
1 and
4294967295) .
</para>
583 <term><varname>TxChannels=
</varname></term>
585 <para>Sets the number of transmit channels (a number between
1 and
4294967295).
</para>
589 <term><varname>OtherChannels=
</varname></term>
591 <para>Sets the number of other channels (a number between
1 and
4294967295).
</para>
595 <term><varname>CombinedChannels=
</varname></term>
597 <para>Sets the number of combined set channels (a number between
1 and
4294967295).
</para>
604 <title>Examples
</title>
607 <title>/usr/lib/systemd/network/
99-default.link
</title>
609 <para>The link file
<filename>99-default.link
</filename> that is
610 shipped with systemd defines the default naming policy for
613 <programlisting>[Link]
614 NamePolicy=kernel database onboard slot path
615 MACAddressPolicy=persistent
</programlisting>
619 <title>/etc/systemd/network/
10-dmz.link
</title>
621 <para>This example assigns the fixed name
622 <literal>dmz0
</literal> to the interface with the MAC address
623 00:a0:de:
63:
7a:e6:
</para>
625 <programlisting>[Match]
626 MACAddress=
00:a0:de:
63:
7a:e6
629 Name=dmz0
</programlisting>
633 <title>/etc/systemd/network/
10-internet.link
</title>
635 <para>This example assigns the fixed name
636 <literal>internet0
</literal> to the interface with the device
637 path
<literal>pci-
0000:
00:
1a
.0-*
</literal>:
</para>
639 <programlisting>[Match]
640 Path=pci-
0000:
00:
1a
.0-*
643 Name=internet0
</programlisting>
647 <title>/etc/systemd/network/
25-wireless.link
</title>
649 <para>Here's an overly complex example that shows the use of a large number of [Match] and [Link] settings.
</para>
651 <programlisting>[Match]
652 MACAddress=
12:
34:
56:
78:
9a:bc
654 Path=pci-
0000:
02:
00.0-*
665 MACAddress=cb:a9:
87:
65:
43:
21</programlisting>
670 <title>See Also
</title>
673 <refentrytitle>systemd-udevd.service
</refentrytitle><manvolnum>8</manvolnum>
676 <refentrytitle>udevadm
</refentrytitle><manvolnum>8</manvolnum>
679 <refentrytitle>systemd.netdev
</refentrytitle><manvolnum>5</manvolnum>
682 <refentrytitle>systemd.network
</refentrytitle><manvolnum>5</manvolnum>