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>The device name, as exposed by the udev property
107 "INTERFACE". May contain shell style globs. This can not be
108 used to match on names that have already been changed from
109 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>The persistent path, as exposed by the
118 udev property <literal>ID_PATH</literal>. May
119 contain shell style globs.</para>
123 <term><varname>Driver=</varname></term>
125 <para>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>The device type, as exposed by the udev
136 property <literal>DEVTYPE</literal>.</para>
140 <term><varname>Host=</varname></term>
142 <para>Matches against the hostname or machine
143 ID of the host. See <literal>ConditionHost=</literal> in
144 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
149 <term><varname>Virtualization=</varname></term>
151 <para>Checks whether the system is executed in
152 a virtualized environment and optionally test
153 whether it is a specific implementation. See
154 <literal>ConditionVirtualization=</literal> in
155 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
160 <term><varname>KernelCommandLine=</varname></term>
162 <para>Checks whether a specific kernel command line option
163 is set (or if prefixed with the exclamation mark unset). See
164 <literal>ConditionKernelCommandLine=</literal> in
165 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
170 <term><varname>Architecture=</varname></term>
172 <para>Checks whether the system is running on a specific
173 architecture. See <literal>ConditionArchitecture=</literal>
175 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
184 <title>[Link] Section Options</title>
186 <para>The <literal>[Link]</literal> section accepts the following
189 <variablelist class='network-directives'>
191 <term><varname>Description=</varname></term>
193 <para>A description of the device.</para>
197 <term><varname>Alias=</varname></term>
199 <para>The <literal>ifalias</literal> is set to this
204 <term><varname>MACAddressPolicy=</varname></term>
206 <para>The policy by which the MAC address should be set. The
207 available policies are:
212 <term><literal>persistent</literal></term>
214 <para>If the hardware has a persistent MAC address, as
215 most hardware should, and if it is used by the kernel,
216 nothing is done. Otherwise, a new MAC address is
217 generated which is guaranteed to be the same on every
218 boot for the given machine and the given device, but
219 which is otherwise random. This feature depends on ID_NET_NAME_*
220 properties existing for the link, on hardware where these
221 properties are not set the generation of a persistent mac address
226 <term><literal>random</literal></term>
228 <para>If the kernel is using a random MAC address,
229 nothing is done. Otherwise, a new address is randomly
230 generated each time the device appears, typically at
238 <term><varname>MACAddress=</varname></term>
240 <para>The MAC address to use, if no
241 <literal>MACAddressPolicy=</literal>
246 <term><varname>NamePolicy=</varname></term>
248 <para>An ordered, space-separated list of policies by which
249 the interface name should be set.
250 <literal>NamePolicy</literal> may be disabled by specifying
251 <literal>net.ifnames=0</literal> on the kernel command line.
252 Each of the policies may fail, and the first successful one
253 is used. The name is not set directly, but is exported to
254 udev as the property <literal>ID_NET_NAME</literal>, which
255 is, by default, used by a udev rule to set
256 <literal>NAME</literal>. If the name has already been set by
257 userspace, no renaming is performed. The available policies
262 <term><literal>kernel</literal></term>
264 <para>If the kernel claims that the name it has set
265 for a device is predictable, then no renaming is
270 <term><literal>database</literal></term>
272 <para>The name is set based on entries in the udev's
273 Hardware Database with the key
274 <literal>ID_NET_NAME_FROM_DATABASE</literal>.
279 <term><literal>onboard</literal></term>
281 <para>The name is set based on information given by
282 the firmware for on-board devices, as exported by the
283 udev property <literal>ID_NET_NAME_ONBOARD</literal>.
288 <term><literal>slot</literal></term>
290 <para>The name is set based on information given by
291 the firmware for hot-plug devices, as exported by the
292 udev property <literal>ID_NET_NAME_SLOT</literal>.
297 <term><literal>path</literal></term>
299 <para>The name is set based on the device's physical
300 location, as exported by the udev property
301 <literal>ID_NET_NAME_PATH</literal>.</para>
305 <term><literal>mac</literal></term>
307 <para>The name is set based on the device's persistent
308 MAC address, as exported by the udev property
309 <literal>ID_NET_NAME_MAC</literal>.</para>
316 <term><varname>Name=</varname></term>
318 <para>The interface name to use in case all the
319 policies specified in
320 <varname>NamePolicy=</varname> fail, or in case
321 <varname>NamePolicy=</varname> is missing or
326 <term><varname>MTUBytes=</varname></term>
328 <para>The maximum transmission unit in bytes to set for the
329 device. The usual suffixes K, M, G, are supported and are
330 understood to the base of 1024.</para>
334 <term><varname>BitsPerSecond=</varname></term>
336 <para>The speed to set for the device, the value is rounded
337 down to the nearest Mbps. The usual suffixes K, M, G, are
338 supported and are understood to the base of 1000.</para>
342 <term><varname>Duplex=</varname></term>
344 <para>The duplex mode to set for the device. The accepted
345 values are <literal>half</literal> and
346 <literal>full</literal>.</para>
350 <term><varname>WakeOnLan=</varname></term>
352 <para>The Wake-on-LAN policy to set for the device. The
353 supported values are:</para>
357 <term><literal>phy</literal></term>
359 <para>Wake on PHY activity.</para>
363 <term><literal>magic</literal></term>
365 <para>Wake on receipt of a magic packet.
370 <term><literal>off</literal></term>
372 <para>Never wake.</para>
382 <title>Example</title>
384 <title>/etc/systemd/network/wireless.link</title>
386 <programlisting>[Match]
387 MACAddress=12:34:56:78:9a:bc
389 Path=pci-0000:02:00.0-*
400 MACAddress=cb:a9:87:65:43:21</programlisting>
405 <title>See Also</title>
408 <refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum>
411 <refentrytitle>udevadm</refentrytitle><manvolnum>8</manvolnum>
414 <refentrytitle>systemd.netdev</refentrytitle><manvolnum>5</manvolnum>
417 <refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum>