1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"?>
3 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
4 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
7 This file is part of systemd.
9 Copyright 2014 Tom Gundersen
11 systemd is free software; you can redistribute it and/or modify it
12 under the terms of the GNU Lesser General Public License as published by
13 the Free Software Foundation; either version 2.1 of the License, or
14 (at your option) any later version.
16 systemd is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 Lesser General Public License for more details.
21 You should have received a copy of the GNU Lesser General Public License
22 along with systemd; If not, see <http://www.gnu.org/licenses/>.
25 <refentry id="systemd.link">
27 <title>systemd.link</title>
28 <productname>systemd</productname>
32 <contrib>Developer</contrib>
33 <firstname>Tom</firstname>
34 <surname>Gundersen</surname>
40 <refentrytitle>systemd.link</refentrytitle>
41 <manvolnum>5</manvolnum>
45 <refname>systemd.link</refname>
46 <refpurpose>Network device configuration</refpurpose>
50 <para><filename><replaceable>link</replaceable>.link</filename></para>
54 <title>Description</title>
56 <para>Network link configuration is performed by the
57 <command>net_setup_link</command> udev builtin.</para>
59 <para>The link files are read from the files located in the system
60 network directory <filename>/usr/lib/systemd/network</filename>,
61 the volatile runtime network directory
62 <filename>/run/systemd/network</filename>, and the local
63 administration network directory
64 <filename>/etc/systemd/network</filename>. Link files must have
65 the extension <filename>.link</filename>; other extensions are
66 ignored. All link files are collectively sorted and processed in
67 lexical order, regardless of the directories in which they live.
68 However, files with identical filenames replace each other. Files
69 in <filename>/etc</filename> have the highest priority, files in
70 <filename>/run</filename> take precedence over files with the same
71 name in <filename>/usr/lib</filename>. This can be used to
72 override a system-supplied link file with a local file if needed;
73 a symlink in <filename>/etc</filename> with the same name as a
74 link file in <filename>/usr/lib</filename>, pointing to
75 <filename>/dev/null</filename>, disables the link file
78 <para>The link file contains a <literal>[Match]</literal> section,
79 which determines if a given link file may be applied to a given
80 device, as well as a <literal>[Link]</literal> section specifying
81 how the device should be configured. The first (in lexical order)
82 of the link files that matches a given device is applied. Note
83 that a default file <filename>99-default.link</filename> is
84 shipped by the system, any user-supplied
85 <filename>.link</filename> should hence have a lexically earlier
86 name to be considered at all.</para>
90 <title>[Match] Section Options</title>
92 <para>A link file is said to match a device if each of the entries
93 in the <literal>[Match]</literal> section matches, or if the
94 section is empty. The following keys are accepted:</para>
96 <variablelist class='network-directives'>
98 <term><varname>MACAddress=</varname></term>
100 <para>The hardware address.</para>
104 <term><varname>OriginalName=</varname></term>
106 <para>A whitespace-separated list of shell-style globs matching
107 the device name, as exposed by the udev property
108 "INTERFACE". This can not be used to match on names that have
109 already been changed from userspace. Caution is advised when matching on
110 kernel-assigned names, as they are known to be unstable
111 between reboots.</para>
115 <term><varname>Path=</varname></term>
117 <para>A whitespace-separated list of shell-style globs matching
118 the persistent path, as exposed by the udev property
119 <literal>ID_PATH</literal>.</para>
123 <term><varname>Driver=</varname></term>
125 <para>A whitespace-separated list of shell-style globs matching
126 the driver currently bound to the device,
127 as exposed by the udev property <literal>DRIVER</literal>
128 of its parent device, or if that is not set, the
129 driver as exposed by <literal>ethtool -i</literal>
130 of the device itself.</para>
134 <term><varname>Type=</varname></term>
136 <para>A whitespace-separated list of shell-style globs matching
137 the device type, as exposed by the udev
138 property <literal>DEVTYPE</literal>.</para>
142 <term><varname>Host=</varname></term>
144 <para>Matches against the hostname or machine
145 ID of the host. See <literal>ConditionHost=</literal> in
146 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
151 <term><varname>Virtualization=</varname></term>
153 <para>Checks whether the system is executed in
154 a virtualized environment and optionally test
155 whether it is a specific implementation. See
156 <literal>ConditionVirtualization=</literal> in
157 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
162 <term><varname>KernelCommandLine=</varname></term>
164 <para>Checks whether a specific kernel command line option
165 is set (or if prefixed with the exclamation mark unset). See
166 <literal>ConditionKernelCommandLine=</literal> in
167 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
172 <term><varname>Architecture=</varname></term>
174 <para>Checks whether the system is running on a specific
175 architecture. See <literal>ConditionArchitecture=</literal>
177 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
186 <title>[Link] Section Options</title>
188 <para>The <literal>[Link]</literal> section accepts the following
191 <variablelist class='network-directives'>
193 <term><varname>Description=</varname></term>
195 <para>A description of the device.</para>
199 <term><varname>Alias=</varname></term>
201 <para>The <literal>ifalias</literal> is set to this
206 <term><varname>MACAddressPolicy=</varname></term>
208 <para>The policy by which the MAC address should be set. The
209 available policies are:
214 <term><literal>persistent</literal></term>
216 <para>If the hardware has a persistent MAC address, as
217 most hardware should, and if it is used by the kernel,
218 nothing is done. Otherwise, a new MAC address is
219 generated which is guaranteed to be the same on every
220 boot for the given machine and the given device, but
221 which is otherwise random. This feature depends on ID_NET_NAME_*
222 properties existing for the link, on hardware where these
223 properties are not set the generation of a persistent MAC address
228 <term><literal>random</literal></term>
230 <para>If the kernel is using a random MAC address,
231 nothing is done. Otherwise, a new address is randomly
232 generated each time the device appears, typically at
240 <term><varname>MACAddress=</varname></term>
242 <para>The MAC address to use, if no
243 <literal>MACAddressPolicy=</literal>
248 <term><varname>NamePolicy=</varname></term>
250 <para>An ordered, space-separated list of policies by which
251 the interface name should be set.
252 <literal>NamePolicy</literal> may be disabled by specifying
253 <literal>net.ifnames=0</literal> on the kernel command line.
254 Each of the policies may fail, and the first successful one
255 is used. The name is not set directly, but is exported to
256 udev as the property <literal>ID_NET_NAME</literal>, which
257 is, by default, used by a udev rule to set
258 <literal>NAME</literal>. If the name has already been set by
259 userspace, no renaming is performed. The available policies
264 <term><literal>kernel</literal></term>
266 <para>If the kernel claims that the name it has set
267 for a device is predictable, then no renaming is
272 <term><literal>database</literal></term>
274 <para>The name is set based on entries in the udev's
275 Hardware Database with the key
276 <literal>ID_NET_NAME_FROM_DATABASE</literal>.
281 <term><literal>onboard</literal></term>
283 <para>The name is set based on information given by
284 the firmware for on-board devices, as exported by the
285 udev property <literal>ID_NET_NAME_ONBOARD</literal>.
290 <term><literal>slot</literal></term>
292 <para>The name is set based on information given by
293 the firmware for hot-plug devices, as exported by the
294 udev property <literal>ID_NET_NAME_SLOT</literal>.
299 <term><literal>path</literal></term>
301 <para>The name is set based on the device's physical
302 location, as exported by the udev property
303 <literal>ID_NET_NAME_PATH</literal>.</para>
307 <term><literal>mac</literal></term>
309 <para>The name is set based on the device's persistent
310 MAC address, as exported by the udev property
311 <literal>ID_NET_NAME_MAC</literal>.</para>
318 <term><varname>Name=</varname></term>
320 <para>The interface name to use in case all the
321 policies specified in
322 <varname>NamePolicy=</varname> fail, or in case
323 <varname>NamePolicy=</varname> is missing or
328 <term><varname>MTUBytes=</varname></term>
330 <para>The maximum transmission unit in bytes to set for the
331 device. The usual suffixes K, M, G, are supported and are
332 understood to the base of 1024.</para>
336 <term><varname>BitsPerSecond=</varname></term>
338 <para>The speed to set for the device, the value is rounded
339 down to the nearest Mbps. The usual suffixes K, M, G, are
340 supported and are understood to the base of 1000.</para>
344 <term><varname>Duplex=</varname></term>
346 <para>The duplex mode to set for the device. The accepted
347 values are <literal>half</literal> and
348 <literal>full</literal>.</para>
352 <term><varname>WakeOnLan=</varname></term>
354 <para>The Wake-on-LAN policy to set for the device. The
355 supported values are:</para>
359 <term><literal>phy</literal></term>
361 <para>Wake on PHY activity.</para>
365 <term><literal>magic</literal></term>
367 <para>Wake on receipt of a magic packet.
372 <term><literal>off</literal></term>
374 <para>Never wake.</para>
384 <title>Example</title>
386 <title>/etc/systemd/network/wireless.link</title>
388 <programlisting>[Match]
389 MACAddress=12:34:56:78:9a:bc
391 Path=pci-0000:02:00.0-*
402 MACAddress=cb:a9:87:65:43:21</programlisting>
407 <title>See Also</title>
410 <refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum>
413 <refentrytitle>udevadm</refentrytitle><manvolnum>8</manvolnum>
416 <refentrytitle>systemd.netdev</refentrytitle><manvolnum>5</manvolnum>
419 <refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum>