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 <literal>[Match]</literal> section, which
75 determines if a given link file may be applied to a given device; and a
76 <literal>[Link]</literal> section specifying how the device should be
77 configured. The first (in lexical order) of the link files that matches
78 a given device is applied.</para>
82 <title>[Match] Section Options</title>
84 <para>A link file is said to match a device if each of the entries in the
85 <literal>[Match]</literal> section matches, or if the section is empty.
86 The following keys are accepted:</para>
88 <variablelist class='network-directives'>
90 <term><varname>MACAddress=</varname></term>
92 <para>The hardware address.</para>
96 <term><varname>Path=</varname></term>
98 <para>The persistent path, as exposed by the
99 udev property <literal>ID_PATH</literal>. May
100 contain shell style globs.</para>
104 <term><varname>Driver=</varname></term>
106 <para>The driver currently bound to the device,
107 as exposed by the udev property <literal>DRIVER</literal>
108 of its parent device, or if that is not set, the
109 driver as exposed by <literal>ethtool -i</literal>
110 of the device itself.</para>
114 <term><varname>Type=</varname></term>
116 <para>The device type, as exposed by the udev
117 property <literal>DEVTYPE</literal>.</para>
121 <term><varname>Host=</varname></term>
123 <para>Matches against the hostname or machine
124 ID of the host. See <literal>ConditionHost=</literal> in
125 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
130 <term><varname>Virtualization=</varname></term>
132 <para>Checks whether the system is executed in
133 a virtualized environment and optionally test
134 whether it is a specific implementation. See
135 <literal>ConditionVirtualization=</literal> in
136 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
141 <term><varname>KernelCommandLine=</varname></term>
143 <para>Checks whether a specific kernel command
144 line option is set (or if prefixed with the
145 exclamation mark unset). See
146 <literal>ConditionKernelCommandLine=</literal> in
147 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
152 <term><varname>Architecture=</varname></term>
154 <para>Checks whether the system is running on a
155 specific architecture. See
156 <literal>ConditionArchitecture=</literal> in
157 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
166 <title>[Link] Section Options</title>
168 <para>The <literal>[Link]</literal> section accepts the following
171 <variablelist class='network-directives'>
173 <term><varname>Description=</varname></term>
175 <para>A description of the device.</para>
179 <term><varname>Alias=</varname></term>
181 <para>The <literal>ifalias</literal> is set to
186 <term><varname>MACAddressPolicy=</varname></term>
188 <para>The policy by which the MAC address
189 should be set. The available policies are:
194 <term><literal>persistent</literal></term>
196 <para>If the hardware has a persistent
197 MAC address, as most hardware should,
198 and if it is used by the kernel, nothing
199 is done. Otherwise, a new MAC address
200 is generated which is guaranteed to be
201 the same on every boot for the given
202 machine and the given device, but which
203 is otherwise random.</para>
207 <term><literal>random</literal></term>
209 <para>If the kernel is using a random MAC
210 address, nothing is done. Otherwise, a new
211 address is randomly generated each time the
212 device appears, typically at boot.</para>
219 <term><varname>MACAddress=</varname></term>
221 <para>The MAC address to use, if no
222 <literal>MACAddressPolicy=</literal>
227 <term><varname>NamePolicy=</varname></term>
229 <para>An ordered, space-separated list of
230 policies by which the interface name should
231 be set. <literal>NamePolicy</literal> may be
232 disabled by specifying
233 <literal>net.ifnames=0</literal> on the kernel
234 commandline. Each of the policies may fail, and
235 the first successful one is used. The name is
236 not set directly, but is exported to udev as
237 the property <literal>ID_NET_NAME</literal>,
238 which is, by default, used by a udev rule to set
239 <literal>NAME</literal>. The available policies
244 <term><literal>database</literal></term>
246 <para>The name is set based on entries in
247 the udev's Hardware Database with the key
248 <literal>ID_NET_NAME_FROM_DATABASE</literal>.
253 <term><literal>onboard</literal></term>
255 <para>The name is set based on information given by
256 the firmware for on-board devices, as exported by
257 the udev property <literal>ID_NET_NAME_ONBOARD</literal>.
262 <term><literal>slot</literal></term>
264 <para>The name is set based on information given by
265 the firmware for hot-plug devices, as exported by
266 the udev property <literal>ID_NET_NAME_SLOT</literal>.
271 <term><literal>path</literal></term>
273 <para>The name is set based on the device's physical
274 location, as exported by the udev property
275 <literal>ID_NET_NAME_PATH</literal>.</para>
279 <term><literal>mac</literal></term>
281 <para>The name is set based on the device's
282 persistent MAC address, as exported by the udev
283 property <literal>ID_NET_NAME_MAC</literal>.</para>
290 <term><varname>Name=</varname></term>
292 <para>The interface name to use in case all the
293 policies specified in
294 <varname>NamePolicy=</varname> fail, or in case
295 <varname>NamePolicy=</varname> is missing or
300 <term><varname>MTUBytes=</varname></term>
302 <para>The maximum transmission unit in bytes to
303 set for the device. The usual suffixes K, M, G,
304 are supported and are understood to the base of
309 <term><varname>BitsPerSecond=</varname></term>
311 <para>The speed to set for the device, the
312 value is rounded down to the nearest Mbps.
313 The usual suffixes K, M, G, are supported and
314 are understood to the base of 1000.</para>
318 <term><varname>Duplex=</varname></term>
320 <para>The duplex mode to set for the device.
321 The accepted values are <literal>half</literal>
322 and <literal>full</literal>.</para>
326 <term><varname>WakeOnLan=</varname></term>
328 <para>The Wake-on-LAN policy to set for the
329 device. The supported values are:</para>
333 <term><literal>phy</literal></term>
335 <para>Wake on PHY activity.</para>
339 <term><literal>magic</literal></term>
341 <para>Wake on receipt of a magic packet.
346 <term><literal>off</literal></term>
348 <para>Never wake.</para>
358 <title>Example</title>
360 <title>/etc/systemd/network/wireless.link</title>
362 <programlisting>[Match]
363 MACAddress=12:34:56:78:9a:bc
365 Path=pci-0000:02:00.0-*
376 MACAddress=cb:a9:87:65:43:21</programlisting>
381 <title>See Also</title>
384 <refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum>
387 <refentrytitle>udevadm</refentrytitle><manvolnum>8</manvolnum>