1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
6 This file is part of systemd.
8 Copyright 2014 Tom Gundersen
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
24 <refentry id="systemd.link">
26 <title>systemd.link</title>
27 <productname>systemd</productname>
31 <contrib>Developer</contrib>
32 <firstname>Tom</firstname>
33 <surname>Gundersen</surname>
39 <refentrytitle>systemd.link</refentrytitle>
40 <manvolnum>5</manvolnum>
44 <refname>systemd.link</refname>
45 <refpurpose>Network device configuration</refpurpose>
49 <para><filename><replaceable>link</replaceable>.link</filename></para>
53 <title>Description</title>
55 <para>Network link configuration is performed by the
56 <command>net_setup_link</command> udev builtin.</para>
58 <para>The link files are read from the files located in the system
59 network directory <filename>/usr/lib/systemd/network</filename>,
60 the volatile runtime network directory
61 <filename>/run/systemd/network</filename>, and the local
62 administration network directory
63 <filename>/etc/systemd/network</filename>. Link files must have
64 the extension <filename>.link</filename>; other extensions are
65 ignored. All link files are collectively sorted and processed in
66 lexical order, regardless of the directories in which they live.
67 However, files with identical filenames replace each other. Files
68 in <filename>/etc</filename> have the highest priority, files in
69 <filename>/run</filename> take precedence over files with the same
70 name in <filename>/usr/lib</filename>. This can be used to
71 override a system-supplied link file with a local file if needed;
72 a symlink in <filename>/etc</filename> with the same name as a
73 link file in <filename>/usr/lib</filename>, pointing to
74 <filename>/dev/null</filename>, disables the link file
77 <para>The link file contains a <literal>[Match]</literal> section,
78 which determines if a given link file may be applied to a given
79 device, as well as a <literal>[Link]</literal> section specifying
80 how the device should be configured. The first (in lexical order)
81 of the link files that matches a given device is applied. Note
82 that a default file <filename>99-default.link</filename> is
83 shipped by the system, any user-supplied
84 <filename>.link</filename> should hence have a lexically earlier
85 name to be considered at all.</para>
89 <title>[Match] Section Options</title>
91 <para>A link file is said to match a device if each of the entries
92 in the <literal>[Match]</literal> section matches, or if the
93 section is empty. The following keys are accepted:</para>
95 <variablelist class='network-directives'>
97 <term><varname>MACAddress=</varname></term>
99 <para>The hardware address.</para>
103 <term><varname>OriginalName=</varname></term>
105 <para>A whitespace-separated list of shell-style globs matching
106 the device name, as exposed by the udev property
107 "INTERFACE". This can not be used to match on names that have
108 already been changed from userspace. Caution is advised when matching on
109 kernel-assigned names, as they are known to be unstable
110 between reboots.</para>
114 <term><varname>Path=</varname></term>
116 <para>A whitespace-separated list of shell-style globs matching
117 the persistent path, as exposed by the udev property
118 <literal>ID_PATH</literal>.</para>
122 <term><varname>Driver=</varname></term>
124 <para>A whitespace-separated list of shell-style globs matching
125 the driver currently bound to the device,
126 as exposed by the udev property <literal>DRIVER</literal>
127 of its parent device, or if that is not set, the
128 driver as exposed by <literal>ethtool -i</literal>
129 of the device itself.</para>
133 <term><varname>Type=</varname></term>
135 <para>A whitespace-separated list of shell-style globs matching
136 the device type, as exposed by the udev
137 property <literal>DEVTYPE</literal>.</para>
141 <term><varname>Host=</varname></term>
143 <para>Matches against the hostname or machine
144 ID of the host. See <literal>ConditionHost=</literal> in
145 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
150 <term><varname>Virtualization=</varname></term>
152 <para>Checks whether the system is executed in
153 a virtualized environment and optionally test
154 whether it is a specific implementation. See
155 <literal>ConditionVirtualization=</literal> in
156 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
161 <term><varname>KernelCommandLine=</varname></term>
163 <para>Checks whether a specific kernel command line option
164 is set (or if prefixed with the exclamation mark unset). See
165 <literal>ConditionKernelCommandLine=</literal> in
166 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
171 <term><varname>Architecture=</varname></term>
173 <para>Checks whether the system is running on a specific
174 architecture. See <literal>ConditionArchitecture=</literal>
176 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
185 <title>[Link] Section Options</title>
187 <para>The <literal>[Link]</literal> section accepts the following
190 <variablelist class='network-directives'>
192 <term><varname>Description=</varname></term>
194 <para>A description of the device.</para>
198 <term><varname>Alias=</varname></term>
200 <para>The <literal>ifalias</literal> is set to this
205 <term><varname>MACAddressPolicy=</varname></term>
207 <para>The policy by which the MAC address should be set. The
208 available policies are:
213 <term><literal>persistent</literal></term>
215 <para>If the hardware has a persistent MAC address, as
216 most hardware should, and if it is used by the kernel,
217 nothing is done. Otherwise, a new MAC address is
218 generated which is guaranteed to be the same on every
219 boot for the given machine and the given device, but
220 which is otherwise random. This feature depends on ID_NET_NAME_*
221 properties existing for the link, on hardware where these
222 properties are not set the generation of a persistent MAC address
227 <term><literal>random</literal></term>
229 <para>If the kernel is using a random MAC address,
230 nothing is done. Otherwise, a new address is randomly
231 generated each time the device appears, typically at
239 <term><varname>MACAddress=</varname></term>
241 <para>The MAC address to use, if no
242 <literal>MACAddressPolicy=</literal>
247 <term><varname>NamePolicy=</varname></term>
249 <para>An ordered, space-separated list of policies by which
250 the interface name should be set.
251 <literal>NamePolicy</literal> may be disabled by specifying
252 <literal>net.ifnames=0</literal> on the kernel command line.
253 Each of the policies may fail, and the first successful one
254 is used. The name is not set directly, but is exported to
255 udev as the property <literal>ID_NET_NAME</literal>, which
256 is, by default, used by a udev rule to set
257 <literal>NAME</literal>. If the name has already been set by
258 userspace, no renaming is performed. The available policies
263 <term><literal>kernel</literal></term>
265 <para>If the kernel claims that the name it has set
266 for a device is predictable, then no renaming is
271 <term><literal>database</literal></term>
273 <para>The name is set based on entries in the udev's
274 Hardware Database with the key
275 <literal>ID_NET_NAME_FROM_DATABASE</literal>.
280 <term><literal>onboard</literal></term>
282 <para>The name is set based on information given by
283 the firmware for on-board devices, as exported by the
284 udev property <literal>ID_NET_NAME_ONBOARD</literal>.
289 <term><literal>slot</literal></term>
291 <para>The name is set based on information given by
292 the firmware for hot-plug devices, as exported by the
293 udev property <literal>ID_NET_NAME_SLOT</literal>.
298 <term><literal>path</literal></term>
300 <para>The name is set based on the device's physical
301 location, as exported by the udev property
302 <literal>ID_NET_NAME_PATH</literal>.</para>
306 <term><literal>mac</literal></term>
308 <para>The name is set based on the device's persistent
309 MAC address, as exported by the udev property
310 <literal>ID_NET_NAME_MAC</literal>.</para>
317 <term><varname>Name=</varname></term>
319 <para>The interface name to use in case all the
320 policies specified in
321 <varname>NamePolicy=</varname> fail, or in case
322 <varname>NamePolicy=</varname> is missing or
327 <term><varname>MTUBytes=</varname></term>
329 <para>The maximum transmission unit in bytes to set for the
330 device. The usual suffixes K, M, G, are supported and are
331 understood to the base of 1024.</para>
335 <term><varname>BitsPerSecond=</varname></term>
337 <para>The speed to set for the device, the value is rounded
338 down to the nearest Mbps. The usual suffixes K, M, G, are
339 supported and are understood to the base of 1000.</para>
343 <term><varname>Duplex=</varname></term>
345 <para>The duplex mode to set for the device. The accepted
346 values are <literal>half</literal> and
347 <literal>full</literal>.</para>
351 <term><varname>WakeOnLan=</varname></term>
353 <para>The Wake-on-LAN policy to set for the device. The
354 supported values are:</para>
358 <term><literal>phy</literal></term>
360 <para>Wake on PHY activity.</para>
364 <term><literal>magic</literal></term>
366 <para>Wake on receipt of a magic packet.
371 <term><literal>off</literal></term>
373 <para>Never wake.</para>
383 <title>Example</title>
385 <title>/etc/systemd/network/wireless.link</title>
387 <programlisting>[Match]
388 MACAddress=12:34:56:78:9a:bc
390 Path=pci-0000:02:00.0-*
401 MACAddress=cb:a9:87:65:43:21</programlisting>
406 <title>See Also</title>
409 <refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum>
412 <refentrytitle>udevadm</refentrytitle><manvolnum>8</manvolnum>
415 <refentrytitle>systemd.netdev</refentrytitle><manvolnum>5</manvolnum>
418 <refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum>