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 This file is part of systemd.
10 Copyright 2014 Tom Gundersen
13 <refentry id=
"systemd.link">
15 <title>systemd.link
</title>
16 <productname>systemd
</productname>
20 <contrib>Developer
</contrib>
21 <firstname>Tom
</firstname>
22 <surname>Gundersen
</surname>
28 <refentrytitle>systemd.link
</refentrytitle>
29 <manvolnum>5</manvolnum>
33 <refname>systemd.link
</refname>
34 <refpurpose>Network device configuration
</refpurpose>
38 <para><filename><replaceable>link
</replaceable>.link
</filename></para>
42 <title>Description
</title>
44 <para>Network link configuration is performed by the
45 <command>net_setup_link
</command> udev builtin.
</para>
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>
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>
76 <citerefentry><refentrytitle>udevadm
</refentrytitle><manvolnum>8</manvolnum></citerefentry>
77 for diagnosing problems with
<filename>.link
</filename> files.
</para>
81 <title>[Match] Section Options
</title>
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>
87 <variablelist class='network-directives'
>
89 <term><varname>MACAddress=
</varname></term>
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>
96 <programlisting>MACAddress=
01:
23:
45:
67:
89:ab
00-
11-
22-
33-
44-
55 AABB.CCDD.EEFF
</programlisting></para>
100 <term><varname>OriginalName=
</varname></term>
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>
111 <term><varname>Path=
</varname></term>
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>
119 <term><varname>Driver=
</varname></term>
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>
130 <term><varname>Type=
</varname></term>
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>
138 <term><varname>Host=
</varname></term>
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>
147 <term><varname>Virtualization=
</varname></term>
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>
158 <term><varname>KernelCommandLine=
</varname></term>
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>
168 <term><varname>KernelVersion=
</varname></term>
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
179 <term><varname>Architecture=
</varname></term>
181 <para>Checks whether the system is running on a specific
182 architecture. See
<literal>ConditionArchitecture=
</literal>
184 <citerefentry><refentrytitle>systemd.unit
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
193 <title>[Link] Section Options
</title>
195 <para>The
<literal>[Link]
</literal> section accepts the following
198 <variablelist class='network-directives'
>
200 <term><varname>Description=
</varname></term>
202 <para>A description of the device.
</para>
206 <term><varname>Alias=
</varname></term>
208 <para>The
<literal>ifalias
</literal> is set to this
213 <term><varname>MACAddressPolicy=
</varname></term>
215 <para>The policy by which the MAC address should be set. The
216 available policies are:
221 <term><literal>persistent
</literal></term>
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
235 <term><literal>random
</literal></term>
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>
246 <term><literal>none
</literal></term>
248 <para>Keeps the MAC address assigned by the kernel.
</para>
255 <term><varname>MACAddress=
</varname></term>
257 <para>The MAC address to use, if no
258 <literal>MACAddressPolicy=
</literal>
263 <term><varname>NamePolicy=
</varname></term>
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
279 <term><literal>kernel
</literal></term>
281 <para>If the kernel claims that the name it has set
282 for a device is predictable, then no renaming is
287 <term><literal>database
</literal></term>
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>.
296 <term><literal>onboard
</literal></term>
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>.
305 <term><literal>slot
</literal></term>
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>.
314 <term><literal>path
</literal></term>
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>
322 <term><literal>mac
</literal></term>
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>
333 <term><varname>Name=
</varname></term>
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
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>.
353 <term><varname>MTUBytes=
</varname></term>
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>
361 <term><varname>BitsPerSecond=
</varname></term>
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>
369 <term><varname>Duplex=
</varname></term>
371 <para>The duplex mode to set for the device. The accepted
372 values are
<literal>half
</literal> and
373 <literal>full
</literal>.
</para>
377 <term><varname>AutoNegotiation=
</varname></term>
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
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>
391 <term><varname>WakeOnLan=
</varname></term>
393 <para>The Wake-on-LAN policy to set for the device. The
394 supported values are:
</para>
398 <term><literal>phy
</literal></term>
400 <para>Wake on PHY activity.
</para>
404 <term><literal>unicast
</literal></term>
406 <para>Wake on unicast messages.
</para>
410 <term><literal>multicast
</literal></term>
412 <para>Wake on multicast messages.
</para>
416 <term><literal>broadcast
</literal></term>
418 <para>Wake on broadcast messages.
</para>
422 <term><literal>arp
</literal></term>
424 <para>Wake on ARP.
</para>
428 <term><literal>magic
</literal></term>
430 <para>Wake on receipt of a magic packet.
435 <term><literal>secureon
</literal></term>
437 <para>Enable secureon(tm) password for MagicPacket(tm).
442 <term><literal>off
</literal></term>
444 <para>Never wake.
</para>
449 <para>Defaults to
<literal>off
</literal>.
</para>
453 <term><varname>Port=
</varname></term>
455 <para>The port option is used to select the device port. The
456 supported values are:
</para>
460 <term><literal>tp
</literal></term>
462 <para>An Ethernet interface using Twisted-Pair cable as the medium.
</para>
466 <term><literal>aui
</literal></term>
468 <para>Attachment Unit Interface (AUI). Normally used with hubs.
473 <term><literal>bnc
</literal></term>
475 <para>An Ethernet interface using BNC connectors and co-axial cable.
</para>
479 <term><literal>mii
</literal></term>
481 <para>An Ethernet interface using a Media Independent Interface (MII).
</para>
485 <term><literal>fibre
</literal></term>
487 <para>An Ethernet interface using Optical Fibre as the medium.
</para>
494 <term><varname>TCPSegmentationOffload=
</varname></term>
496 <para>The TCP Segmentation Offload (TSO) when true enables
497 TCP segmentation offload. Takes a boolean value.
498 Defaults to
"unset".
</para>
502 <term><varname>TCP6SegmentationOffload=
</varname></term>
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>
510 <term><varname>GenericSegmentationOffload=
</varname></term>
512 <para>The Generic Segmentation Offload (GSO) when true enables
513 generic segmentation offload. Takes a boolean value.
514 Defaults to
"unset".
</para>
518 <term><varname>GenericReceiveOffload=
</varname></term>
520 <para>The Generic Receive Offload (GRO) when true enables
521 generic receive offload. Takes a boolean value.
522 Defaults to
"unset".
</para>
526 <term><varname>LargeReceiveOffload=
</varname></term>
528 <para>The Large Receive Offload (LRO) when true enables
529 large receive offload. Takes a boolean value.
530 Defaults to
"unset".
</para>
534 <term><varname>RxChannels=
</varname></term>
536 <para>Sets the number of receive channels (a number between
1 and
4294967295) .
</para>
540 <term><varname>TxChannels=
</varname></term>
542 <para>Sets the number of transmit channels (a number between
1 and
4294967295).
</para>
546 <term><varname>OtherChannels=
</varname></term>
548 <para>Sets the number of other channels (a number between
1 and
4294967295).
</para>
552 <term><varname>CombinedChannels=
</varname></term>
554 <para>Sets the number of combined set channels (a number between
1 and
4294967295).
</para>
561 <title>Examples
</title>
564 <title>/usr/lib/systemd/network/
99-default.link
</title>
566 <para>The link file
<filename>99-default.link
</filename> that is
567 shipped with systemd defines the default naming policy for
570 <programlisting>[Link]
571 NamePolicy=kernel database onboard slot path
572 MACAddressPolicy=persistent
</programlisting>
576 <title>/etc/systemd/network/
10-dmz.link
</title>
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>
582 <programlisting>[Match]
583 MACAddress=
00:a0:de:
63:
7a:e6
586 Name=dmz0
</programlisting>
590 <title>/etc/systemd/network/
10-internet.link
</title>
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>
596 <programlisting>[Match]
597 Path=pci-
0000:
00:
1a
.0-*
600 Name=internet0
</programlisting>
604 <title>/etc/systemd/network/
25-wireless.link
</title>
606 <para>Here's an overly complex example that shows the use of a large number of [Match] and [Link] settings.
</para>
608 <programlisting>[Match]
609 MACAddress=
12:
34:
56:
78:
9a:bc
611 Path=pci-
0000:
02:
00.0-*
622 MACAddress=cb:a9:
87:
65:
43:
21</programlisting>
627 <title>See Also
</title>
630 <refentrytitle>systemd-udevd.service
</refentrytitle><manvolnum>8</manvolnum>
633 <refentrytitle>udevadm
</refentrytitle><manvolnum>8</manvolnum>
636 <refentrytitle>systemd.netdev
</refentrytitle><manvolnum>5</manvolnum>
639 <refentrytitle>systemd.network
</refentrytitle><manvolnum>5</manvolnum>