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 <command>net_setup_link</command>
59 <para>The link files are read from the files located in the
60 system network directory <filename>/usr/lib/systemd/network</filename>,
61 the volatile runtime network directory <filename>/run/systemd/network</filename>,
62 and the local administration network directory <filename>/etc/systemd/network</filename>.
63 Link files must have the extension <filename>.link</filename>; other extensions are ignored.
64 All link files are collectively sorted and processed in lexical order,
65 regardless of the directories in which they live. However, files with
66 identical filenames replace each other. Files in <filename>/etc</filename>
67 have the highest priority, files in <filename>/run</filename> take precedence
68 over files with the same name in <filename>/usr/lib</filename>. This can be
69 used to override a system-supplied link file with a local file if needed;
70 a symlink in <filename>/etc</filename> with the same name as a link file in
71 <filename>/usr/lib</filename>, pointing to <filename>/dev/null</filename>,
72 disables the link file entirely.</para>
74 <para>The link file contains a
75 <literal>[Match]</literal> section, which determines
76 if a given link file may be applied to a given device,
77 as well as a <literal>[Link]</literal> section specifying how
78 the device should be configured. The first (in lexical
79 order) of the link files that matches a given device
80 is applied. Note that a default file
81 <filename>99-default.link</filename> is shipped by the
82 system, any user-supplied <filename>.link</filename>
83 should hence have a lexically earlier name to be
84 considered at all.</para>
88 <title>[Match] Section Options</title>
90 <para>A link file is said to match a device if each of the entries in the
91 <literal>[Match]</literal> section matches, or if the section is empty.
92 The following keys are accepted:</para>
94 <variablelist class='network-directives'>
96 <term><varname>MACAddress=</varname></term>
98 <para>The hardware address.</para>
102 <term><varname>OriginalName=</varname></term>
104 <para>The device name, as exposed by the udev
105 property "INTERFACE". May contain shell style
106 globs. This can not be used to match on names
107 that have already been changed from userspace.
108 Caution is advised when matching on
109 kernel-assigned names, as they are known to
110 be unstable between reboots.</para>
114 <term><varname>Path=</varname></term>
116 <para>The persistent path, as exposed by the
117 udev property <literal>ID_PATH</literal>. May
118 contain shell style globs.</para>
122 <term><varname>Driver=</varname></term>
124 <para>The driver currently bound to the device,
125 as exposed by the udev property <literal>DRIVER</literal>
126 of its parent device, or if that is not set, the
127 driver as exposed by <literal>ethtool -i</literal>
128 of the device itself.</para>
132 <term><varname>Type=</varname></term>
134 <para>The device type, as exposed by the udev
135 property <literal>DEVTYPE</literal>.</para>
139 <term><varname>Host=</varname></term>
141 <para>Matches against the hostname or machine
142 ID of the host. See <literal>ConditionHost=</literal> in
143 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
148 <term><varname>Virtualization=</varname></term>
150 <para>Checks whether the system is executed in
151 a virtualized environment and optionally test
152 whether it is a specific implementation. See
153 <literal>ConditionVirtualization=</literal> in
154 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
159 <term><varname>KernelCommandLine=</varname></term>
161 <para>Checks whether a specific kernel command
162 line option is set (or if prefixed with the
163 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
173 specific architecture. See
174 <literal>ConditionArchitecture=</literal> in
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
204 <term><varname>MACAddressPolicy=</varname></term>
206 <para>The policy by which the MAC address
207 should be set. The available policies are:
212 <term><literal>persistent</literal></term>
214 <para>If the hardware has a persistent
215 MAC address, as most hardware should,
216 and if it is used by the kernel, nothing
217 is done. Otherwise, a new MAC address
218 is generated which is guaranteed to be
219 the same on every boot for the given
220 machine and the given device, but which
221 is otherwise random.</para>
225 <term><literal>random</literal></term>
227 <para>If the kernel is using a random MAC
228 address, nothing is done. Otherwise, a new
229 address is randomly generated each time the
230 device appears, typically at boot.</para>
237 <term><varname>MACAddress=</varname></term>
239 <para>The MAC address to use, if no
240 <literal>MACAddressPolicy=</literal>
245 <term><varname>NamePolicy=</varname></term>
247 <para>An ordered, space-separated list of
248 policies by which the interface name should
249 be set. <literal>NamePolicy</literal> may be
250 disabled by specifying
251 <literal>net.ifnames=0</literal> on the kernel
252 command line. Each of the policies may fail, and
253 the first successful one is used. The name is
254 not set directly, but is exported to udev as
255 the property <literal>ID_NET_NAME</literal>,
256 which is, by default, used by a udev rule to set
257 <literal>NAME</literal>. If the name has already
258 been set by userspace, no renaming is performed.
259 The available policies are:</para>
263 <term><literal>kernel</literal></term>
265 <para>If the kernel claims that the name it
266 has set for a device is predictable, then
267 no renaming is performed.
272 <term><literal>database</literal></term>
274 <para>The name is set based on entries in
275 the udev's 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
285 the 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
294 the 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
310 persistent MAC address, as exported by the udev
311 property <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
331 set for the device. The usual suffixes K, M, G,
332 are supported and are understood to the base of
337 <term><varname>BitsPerSecond=</varname></term>
339 <para>The speed to set for the device, the
340 value is rounded down to the nearest Mbps.
341 The usual suffixes K, M, G, are supported and
342 are understood to the base of 1000.</para>
346 <term><varname>Duplex=</varname></term>
348 <para>The duplex mode to set for the device.
349 The accepted values are <literal>half</literal>
350 and <literal>full</literal>.</para>
354 <term><varname>WakeOnLan=</varname></term>
356 <para>The Wake-on-LAN policy to set for the
357 device. The supported values are:</para>
361 <term><literal>phy</literal></term>
363 <para>Wake on PHY activity.</para>
367 <term><literal>magic</literal></term>
369 <para>Wake on receipt of a magic packet.
374 <term><literal>off</literal></term>
376 <para>Never wake.</para>
386 <title>Example</title>
388 <title>/etc/systemd/network/wireless.link</title>
390 <programlisting>[Match]
391 MACAddress=12:34:56:78:9a:bc
393 Path=pci-0000:02:00.0-*
404 MACAddress=cb:a9:87:65:43:21</programlisting>
409 <title>See Also</title>
412 <refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum>
415 <refentrytitle>udevadm</refentrytitle><manvolnum>8</manvolnum>
418 <refentrytitle>systemd.netdev</refentrytitle><manvolnum>5</manvolnum>
421 <refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum>