]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd.link.xml
Merge pull request #375 from msekletar/test-install-crashers
[thirdparty/systemd.git] / man / systemd.link.xml
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">
4
5 <!--
6 This file is part of systemd.
7
8 Copyright 2014 Tom Gundersen
9
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.
14
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.
19
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/>.
22 -->
23
24 <refentry id="systemd.link">
25 <refentryinfo>
26 <title>systemd.link</title>
27 <productname>systemd</productname>
28
29 <authorgroup>
30 <author>
31 <contrib>Developer</contrib>
32 <firstname>Tom</firstname>
33 <surname>Gundersen</surname>
34 </author>
35 </authorgroup>
36 </refentryinfo>
37
38 <refmeta>
39 <refentrytitle>systemd.link</refentrytitle>
40 <manvolnum>5</manvolnum>
41 </refmeta>
42
43 <refnamediv>
44 <refname>systemd.link</refname>
45 <refpurpose>Network device configuration</refpurpose>
46 </refnamediv>
47
48 <refsynopsisdiv>
49 <para><filename><replaceable>link</replaceable>.link</filename></para>
50 </refsynopsisdiv>
51
52 <refsect1>
53 <title>Description</title>
54
55 <para>Network link configuration is performed by the
56 <command>net_setup_link</command> udev builtin.</para>
57
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 As a special case, an empty file (file size 0) or symlink with the
73 same name pointing to <filename>/dev/null</filename>, disable the
74 configuration file entirely (it is "masked").</para>
75
76 <para>The link file contains a <literal>[Match]</literal> section,
77 which determines if a given link file may be applied to a given
78 device, as well as a <literal>[Link]</literal> section specifying
79 how the device should be configured. The first (in lexical order)
80 of the link files that matches a given device is applied. Note
81 that a default file <filename>99-default.link</filename> is
82 shipped by the system, any user-supplied
83 <filename>.link</filename> should hence have a lexically earlier
84 name to be considered at all.</para>
85 </refsect1>
86
87 <refsect1>
88 <title>[Match] Section Options</title>
89
90 <para>A link file is said to match a device if each of the entries
91 in the <literal>[Match]</literal> section matches, or if the
92 section is empty. The following keys are accepted:</para>
93
94 <variablelist class='network-directives'>
95 <varlistentry>
96 <term><varname>MACAddress=</varname></term>
97 <listitem>
98 <para>The hardware address.</para>
99 </listitem>
100 </varlistentry>
101 <varlistentry>
102 <term><varname>OriginalName=</varname></term>
103 <listitem>
104 <para>A whitespace-separated list of shell-style globs matching
105 the device name, as exposed by the udev property
106 "INTERFACE". This can not be used to match on names that have
107 already been changed from userspace. Caution is advised when matching on
108 kernel-assigned names, as they are known to be unstable
109 between reboots.</para>
110 </listitem>
111 </varlistentry>
112 <varlistentry>
113 <term><varname>Path=</varname></term>
114 <listitem>
115 <para>A whitespace-separated list of shell-style globs matching
116 the persistent path, as exposed by the udev property
117 <literal>ID_PATH</literal>.</para>
118 </listitem>
119 </varlistentry>
120 <varlistentry>
121 <term><varname>Driver=</varname></term>
122 <listitem>
123 <para>A whitespace-separated list of shell-style globs matching
124 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>
129 </listitem>
130 </varlistentry>
131 <varlistentry>
132 <term><varname>Type=</varname></term>
133 <listitem>
134 <para>A whitespace-separated list of shell-style globs matching
135 the device type, as exposed by the udev
136 property <literal>DEVTYPE</literal>.</para>
137 </listitem>
138 </varlistentry>
139 <varlistentry>
140 <term><varname>Host=</varname></term>
141 <listitem>
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>
145 for details.</para>
146 </listitem>
147 </varlistentry>
148 <varlistentry>
149 <term><varname>Virtualization=</varname></term>
150 <listitem>
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>
156 for details.</para>
157 </listitem>
158 </varlistentry>
159 <varlistentry>
160 <term><varname>KernelCommandLine=</varname></term>
161 <listitem>
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>
166 for details.</para>
167 </listitem>
168 </varlistentry>
169 <varlistentry>
170 <term><varname>Architecture=</varname></term>
171 <listitem>
172 <para>Checks whether the system is running on a specific
173 architecture. See <literal>ConditionArchitecture=</literal>
174 in
175 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
176 for details.</para>
177 </listitem>
178 </varlistentry>
179 </variablelist>
180
181 </refsect1>
182
183 <refsect1>
184 <title>[Link] Section Options</title>
185
186 <para>The <literal>[Link]</literal> section accepts the following
187 keys:</para>
188
189 <variablelist class='network-directives'>
190 <varlistentry>
191 <term><varname>Description=</varname></term>
192 <listitem>
193 <para>A description of the device.</para>
194 </listitem>
195 </varlistentry>
196 <varlistentry>
197 <term><varname>Alias=</varname></term>
198 <listitem>
199 <para>The <literal>ifalias</literal> is set to this
200 value.</para>
201 </listitem>
202 </varlistentry>
203 <varlistentry>
204 <term><varname>MACAddressPolicy=</varname></term>
205 <listitem>
206 <para>The policy by which the MAC address should be set. The
207 available policies are:
208 </para>
209
210 <variablelist>
211 <varlistentry>
212 <term><literal>persistent</literal></term>
213 <listitem>
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
222 will fail.</para>
223 </listitem>
224 </varlistentry>
225 <varlistentry>
226 <term><literal>random</literal></term>
227 <listitem>
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
231 boot. Either way the random address will have the
232 <literal>unicast</literal> and
233 <literal>locally administered</literal> bits set.</para>
234 </listitem>
235 </varlistentry>
236 </variablelist>
237 </listitem>
238 </varlistentry>
239 <varlistentry>
240 <term><varname>MACAddress=</varname></term>
241 <listitem>
242 <para>The MAC address to use, if no
243 <literal>MACAddressPolicy=</literal>
244 is specified.</para>
245 </listitem>
246 </varlistentry>
247 <varlistentry>
248 <term><varname>NamePolicy=</varname></term>
249 <listitem>
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
260 are:</para>
261
262 <variablelist>
263 <varlistentry>
264 <term><literal>kernel</literal></term>
265 <listitem>
266 <para>If the kernel claims that the name it has set
267 for a device is predictable, then no renaming is
268 performed.</para>
269 </listitem>
270 </varlistentry>
271 <varlistentry>
272 <term><literal>database</literal></term>
273 <listitem>
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>.
277 </para>
278 </listitem>
279 </varlistentry>
280 <varlistentry>
281 <term><literal>onboard</literal></term>
282 <listitem>
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>.
286 </para>
287 </listitem>
288 </varlistentry>
289 <varlistentry>
290 <term><literal>slot</literal></term>
291 <listitem>
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>.
295 </para>
296 </listitem>
297 </varlistentry>
298 <varlistentry>
299 <term><literal>path</literal></term>
300 <listitem>
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>
304 </listitem>
305 </varlistentry>
306 <varlistentry>
307 <term><literal>mac</literal></term>
308 <listitem>
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>
312 </listitem>
313 </varlistentry>
314 </variablelist>
315 </listitem>
316 </varlistentry>
317 <varlistentry>
318 <term><varname>Name=</varname></term>
319 <listitem>
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
324 disabled.</para>
325 </listitem>
326 </varlistentry>
327 <varlistentry>
328 <term><varname>MTUBytes=</varname></term>
329 <listitem>
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>
333 </listitem>
334 </varlistentry>
335 <varlistentry>
336 <term><varname>BitsPerSecond=</varname></term>
337 <listitem>
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>
341 </listitem>
342 </varlistentry>
343 <varlistentry>
344 <term><varname>Duplex=</varname></term>
345 <listitem>
346 <para>The duplex mode to set for the device. The accepted
347 values are <literal>half</literal> and
348 <literal>full</literal>.</para>
349 </listitem>
350 </varlistentry>
351 <varlistentry>
352 <term><varname>WakeOnLan=</varname></term>
353 <listitem>
354 <para>The Wake-on-LAN policy to set for the device. The
355 supported values are:</para>
356
357 <variablelist>
358 <varlistentry>
359 <term><literal>phy</literal></term>
360 <listitem>
361 <para>Wake on PHY activity.</para>
362 </listitem>
363 </varlistentry>
364 <varlistentry>
365 <term><literal>magic</literal></term>
366 <listitem>
367 <para>Wake on receipt of a magic packet.
368 </para>
369 </listitem>
370 </varlistentry>
371 <varlistentry>
372 <term><literal>off</literal></term>
373 <listitem>
374 <para>Never wake.</para>
375 </listitem>
376 </varlistentry>
377 </variablelist>
378 </listitem>
379 </varlistentry>
380 </variablelist>
381 </refsect1>
382
383 <refsect1>
384 <title>Example</title>
385 <example>
386 <title>/etc/systemd/network/wireless.link</title>
387
388 <programlisting>[Match]
389 MACAddress=12:34:56:78:9a:bc
390 Driver=brcmsmac
391 Path=pci-0000:02:00.0-*
392 Type=wlan
393 Virtualization=no
394 Host=my-laptop
395 Architecture=x86-64
396
397 [Link]
398 Name=wireless0
399 MTUBytes=1450
400 BitsPerSecond=10M
401 WakeOnLan=magic
402 MACAddress=cb:a9:87:65:43:21</programlisting>
403 </example>
404 </refsect1>
405
406 <refsect1>
407 <title>See Also</title>
408 <para>
409 <citerefentry>
410 <refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum>
411 </citerefentry>,
412 <citerefentry>
413 <refentrytitle>udevadm</refentrytitle><manvolnum>8</manvolnum>
414 </citerefentry>,
415 <citerefentry>
416 <refentrytitle>systemd.netdev</refentrytitle><manvolnum>5</manvolnum>
417 </citerefentry>,
418 <citerefentry>
419 <refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum>
420 </citerefentry>
421 </para>
422 </refsect1>
423
424 </refentry>