]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd.link.xml
Merge pull request #722 from keszybz/networkd-clarifications
[thirdparty/systemd.git] / man / systemd.link.xml
CommitLineData
1ff28eae 1<?xml version='1.0'?> <!--*-nxml-*-->
1ff28eae 2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
12b42c76 3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
1ff28eae
TG
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">
798d3a52
ZJS
25 <refentryinfo>
26 <title>systemd.link</title>
27 <productname>systemd</productname>
1ff28eae 28
798d3a52
ZJS
29 <authorgroup>
30 <author>
31 <contrib>Developer</contrib>
32 <firstname>Tom</firstname>
33 <surname>Gundersen</surname>
34 </author>
35 </authorgroup>
36 </refentryinfo>
1ff28eae 37
798d3a52
ZJS
38 <refmeta>
39 <refentrytitle>systemd.link</refentrytitle>
40 <manvolnum>5</manvolnum>
41 </refmeta>
1ff28eae 42
798d3a52
ZJS
43 <refnamediv>
44 <refname>systemd.link</refname>
45 <refpurpose>Network device configuration</refpurpose>
46 </refnamediv>
1ff28eae 47
798d3a52
ZJS
48 <refsynopsisdiv>
49 <para><filename><replaceable>link</replaceable>.link</filename></para>
50 </refsynopsisdiv>
1ff28eae 51
798d3a52
ZJS
52 <refsect1>
53 <title>Description</title>
1ff28eae 54
798d3a52
ZJS
55 <para>Network link configuration is performed by the
56 <command>net_setup_link</command> udev builtin.</para>
1ff28eae 57
798d3a52 58 <para>The link files are read from the files located in the system
12b42c76 59 network directory <filename>/usr/lib/systemd/network</filename>,
798d3a52
ZJS
60 the volatile runtime network directory
61 <filename>/run/systemd/network</filename>, and the local
62 administration network directory
12b42c76 63 <filename>/etc/systemd/network</filename>. Link files must have
798d3a52
ZJS
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
12b42c76 70 name in <filename>/usr/lib</filename>. This can be used to
798d3a52
ZJS
71 override a system-supplied link file with a local file if needed;
72 a symlink in <filename>/etc</filename> with the same name as a
12b42c76 73 link file in <filename>/usr/lib</filename>, pointing to
798d3a52
ZJS
74 <filename>/dev/null</filename>, disables the link file
75 entirely.</para>
1ff28eae 76
798d3a52
ZJS
77 <para>The link file contains a <literal>[Match]</literal> section,
78 which determines if a given link file may be applied to a given
79 device, as well as a <literal>[Link]</literal> section specifying
80 how the device should be configured. The first (in lexical order)
81 of the link files that matches a given device is applied. Note
82 that a default file <filename>99-default.link</filename> is
83 shipped by the system, any user-supplied
84 <filename>.link</filename> should hence have a lexically earlier
85 name to be considered at all.</para>
86 </refsect1>
102bd40e 87
798d3a52
ZJS
88 <refsect1>
89 <title>[Match] Section Options</title>
1ff28eae 90
798d3a52
ZJS
91 <para>A link file is said to match a device if each of the entries
92 in the <literal>[Match]</literal> section matches, or if the
93 section is empty. The following keys are accepted:</para>
1ff28eae 94
798d3a52
ZJS
95 <variablelist class='network-directives'>
96 <varlistentry>
97 <term><varname>MACAddress=</varname></term>
98 <listitem>
99 <para>The hardware address.</para>
100 </listitem>
101 </varlistentry>
102 <varlistentry>
103 <term><varname>OriginalName=</varname></term>
104 <listitem>
5256e00e
TG
105 <para>A whitespace-separated list of shell-style globs matching
106 the device name, as exposed by the udev property
107 "INTERFACE". This can not be used to match on names that have
108 already been changed from userspace. Caution is advised when matching on
798d3a52
ZJS
109 kernel-assigned names, as they are known to be unstable
110 between reboots.</para>
111 </listitem>
112 </varlistentry>
113 <varlistentry>
114 <term><varname>Path=</varname></term>
115 <listitem>
5256e00e
TG
116 <para>A whitespace-separated list of shell-style globs matching
117 the persistent path, as exposed by the udev property
118 <literal>ID_PATH</literal>.</para>
798d3a52
ZJS
119 </listitem>
120 </varlistentry>
121 <varlistentry>
122 <term><varname>Driver=</varname></term>
123 <listitem>
5256e00e
TG
124 <para>A whitespace-separated list of shell-style globs matching
125 the driver currently bound to the device,
798d3a52
ZJS
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>
130 </listitem>
131 </varlistentry>
132 <varlistentry>
133 <term><varname>Type=</varname></term>
134 <listitem>
5256e00e
TG
135 <para>A whitespace-separated list of shell-style globs matching
136 the device type, as exposed by the udev
798d3a52
ZJS
137 property <literal>DEVTYPE</literal>.</para>
138 </listitem>
139 </varlistentry>
140 <varlistentry>
141 <term><varname>Host=</varname></term>
142 <listitem>
143 <para>Matches against the hostname or machine
144 ID of the host. See <literal>ConditionHost=</literal> in
145 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
146 for details.</para>
147 </listitem>
148 </varlistentry>
149 <varlistentry>
150 <term><varname>Virtualization=</varname></term>
151 <listitem>
152 <para>Checks whether the system is executed in
153 a virtualized environment and optionally test
154 whether it is a specific implementation. See
155 <literal>ConditionVirtualization=</literal> in
156 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
157 for details.</para>
158 </listitem>
159 </varlistentry>
160 <varlistentry>
161 <term><varname>KernelCommandLine=</varname></term>
162 <listitem>
163 <para>Checks whether a specific kernel command line option
164 is set (or if prefixed with the exclamation mark unset). See
165 <literal>ConditionKernelCommandLine=</literal> in
166 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
167 for details.</para>
168 </listitem>
169 </varlistentry>
170 <varlistentry>
171 <term><varname>Architecture=</varname></term>
172 <listitem>
173 <para>Checks whether the system is running on a specific
174 architecture. See <literal>ConditionArchitecture=</literal>
175 in
176 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
177 for details.</para>
178 </listitem>
179 </varlistentry>
180 </variablelist>
1ff28eae 181
798d3a52 182 </refsect1>
102bd40e 183
798d3a52
ZJS
184 <refsect1>
185 <title>[Link] Section Options</title>
102bd40e 186
798d3a52
ZJS
187 <para>The <literal>[Link]</literal> section accepts the following
188 keys:</para>
1ff28eae 189
798d3a52
ZJS
190 <variablelist class='network-directives'>
191 <varlistentry>
192 <term><varname>Description=</varname></term>
193 <listitem>
194 <para>A description of the device.</para>
195 </listitem>
196 </varlistentry>
197 <varlistentry>
198 <term><varname>Alias=</varname></term>
199 <listitem>
200 <para>The <literal>ifalias</literal> is set to this
201 value.</para>
202 </listitem>
203 </varlistentry>
204 <varlistentry>
205 <term><varname>MACAddressPolicy=</varname></term>
206 <listitem>
207 <para>The policy by which the MAC address should be set. The
208 available policies are:
209 </para>
1ff28eae 210
798d3a52
ZJS
211 <variablelist>
212 <varlistentry>
213 <term><literal>persistent</literal></term>
214 <listitem>
215 <para>If the hardware has a persistent MAC address, as
216 most hardware should, and if it is used by the kernel,
217 nothing is done. Otherwise, a new MAC address is
218 generated which is guaranteed to be the same on every
219 boot for the given machine and the given device, but
1c25683e
TG
220 which is otherwise random. This feature depends on ID_NET_NAME_*
221 properties existing for the link, on hardware where these
e2acdb6b 222 properties are not set the generation of a persistent MAC address
1c25683e 223 will fail.</para>
798d3a52
ZJS
224 </listitem>
225 </varlistentry>
226 <varlistentry>
227 <term><literal>random</literal></term>
228 <listitem>
229 <para>If the kernel is using a random MAC address,
230 nothing is done. Otherwise, a new address is randomly
231 generated each time the device appears, typically at
2e229e0c
TG
232 boot. Either way the random address will have the
233 <literal>unicast</literal> and
234 <literal>locally administered</literal> bits set.</para>
798d3a52
ZJS
235 </listitem>
236 </varlistentry>
237 </variablelist>
238 </listitem>
239 </varlistentry>
240 <varlistentry>
241 <term><varname>MACAddress=</varname></term>
242 <listitem>
243 <para>The MAC address to use, if no
244 <literal>MACAddressPolicy=</literal>
245 is specified.</para>
246 </listitem>
247 </varlistentry>
248 <varlistentry>
249 <term><varname>NamePolicy=</varname></term>
250 <listitem>
251 <para>An ordered, space-separated list of policies by which
252 the interface name should be set.
253 <literal>NamePolicy</literal> may be disabled by specifying
254 <literal>net.ifnames=0</literal> on the kernel command line.
255 Each of the policies may fail, and the first successful one
256 is used. The name is not set directly, but is exported to
257 udev as the property <literal>ID_NET_NAME</literal>, which
258 is, by default, used by a udev rule to set
259 <literal>NAME</literal>. If the name has already been set by
260 userspace, no renaming is performed. The available policies
261 are:</para>
1ff28eae 262
798d3a52
ZJS
263 <variablelist>
264 <varlistentry>
265 <term><literal>kernel</literal></term>
266 <listitem>
267 <para>If the kernel claims that the name it has set
268 for a device is predictable, then no renaming is
269 performed.</para>
270 </listitem>
271 </varlistentry>
272 <varlistentry>
273 <term><literal>database</literal></term>
274 <listitem>
275 <para>The name is set based on entries in the udev's
276 Hardware Database with the key
277 <literal>ID_NET_NAME_FROM_DATABASE</literal>.
278 </para>
279 </listitem>
280 </varlistentry>
281 <varlistentry>
282 <term><literal>onboard</literal></term>
283 <listitem>
284 <para>The name is set based on information given by
285 the firmware for on-board devices, as exported by the
286 udev property <literal>ID_NET_NAME_ONBOARD</literal>.
287 </para>
288 </listitem>
289 </varlistentry>
290 <varlistentry>
291 <term><literal>slot</literal></term>
292 <listitem>
293 <para>The name is set based on information given by
294 the firmware for hot-plug devices, as exported by the
295 udev property <literal>ID_NET_NAME_SLOT</literal>.
296 </para>
297 </listitem>
298 </varlistentry>
299 <varlistentry>
300 <term><literal>path</literal></term>
301 <listitem>
302 <para>The name is set based on the device's physical
303 location, as exported by the udev property
304 <literal>ID_NET_NAME_PATH</literal>.</para>
305 </listitem>
306 </varlistentry>
307 <varlistentry>
308 <term><literal>mac</literal></term>
309 <listitem>
310 <para>The name is set based on the device's persistent
311 MAC address, as exported by the udev property
312 <literal>ID_NET_NAME_MAC</literal>.</para>
313 </listitem>
314 </varlistentry>
315 </variablelist>
316 </listitem>
317 </varlistentry>
318 <varlistentry>
319 <term><varname>Name=</varname></term>
320 <listitem>
321 <para>The interface name to use in case all the
322 policies specified in
323 <varname>NamePolicy=</varname> fail, or in case
324 <varname>NamePolicy=</varname> is missing or
325 disabled.</para>
326 </listitem>
327 </varlistentry>
328 <varlistentry>
329 <term><varname>MTUBytes=</varname></term>
330 <listitem>
331 <para>The maximum transmission unit in bytes to set for the
332 device. The usual suffixes K, M, G, are supported and are
333 understood to the base of 1024.</para>
334 </listitem>
335 </varlistentry>
336 <varlistentry>
337 <term><varname>BitsPerSecond=</varname></term>
338 <listitem>
339 <para>The speed to set for the device, the value is rounded
340 down to the nearest Mbps. The usual suffixes K, M, G, are
341 supported and are understood to the base of 1000.</para>
342 </listitem>
343 </varlistentry>
344 <varlistentry>
345 <term><varname>Duplex=</varname></term>
346 <listitem>
347 <para>The duplex mode to set for the device. The accepted
348 values are <literal>half</literal> and
349 <literal>full</literal>.</para>
350 </listitem>
351 </varlistentry>
352 <varlistentry>
353 <term><varname>WakeOnLan=</varname></term>
354 <listitem>
355 <para>The Wake-on-LAN policy to set for the device. The
356 supported values are:</para>
1ff28eae 357
798d3a52
ZJS
358 <variablelist>
359 <varlistentry>
360 <term><literal>phy</literal></term>
361 <listitem>
362 <para>Wake on PHY activity.</para>
363 </listitem>
364 </varlistentry>
365 <varlistentry>
366 <term><literal>magic</literal></term>
367 <listitem>
368 <para>Wake on receipt of a magic packet.
369 </para>
370 </listitem>
371 </varlistentry>
372 <varlistentry>
373 <term><literal>off</literal></term>
374 <listitem>
375 <para>Never wake.</para>
376 </listitem>
377 </varlistentry>
378 </variablelist>
379 </listitem>
380 </varlistentry>
381 </variablelist>
382 </refsect1>
1ff28eae 383
798d3a52
ZJS
384 <refsect1>
385 <title>Example</title>
386 <example>
12b42c76 387 <title>/etc/systemd/network/wireless.link</title>
1ff28eae 388
798d3a52 389 <programlisting>[Match]
7abaad1a 390MACAddress=12:34:56:78:9a:bc
391Driver=brcmsmac
392Path=pci-0000:02:00.0-*
393Type=wlan
394Virtualization=no
395Host=my-laptop
396Architecture=x86-64
1ff28eae 397
7abaad1a 398[Link]
399Name=wireless0
400MTUBytes=1450
401BitsPerSecond=10M
402WakeOnLan=magic
403MACAddress=cb:a9:87:65:43:21</programlisting>
798d3a52
ZJS
404 </example>
405 </refsect1>
1ff28eae 406
798d3a52
ZJS
407 <refsect1>
408 <title>See Also</title>
409 <para>
410 <citerefentry>
411 <refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum>
412 </citerefentry>,
413 <citerefentry>
414 <refentrytitle>udevadm</refentrytitle><manvolnum>8</manvolnum>
415 </citerefentry>,
416 <citerefentry>
417 <refentrytitle>systemd.netdev</refentrytitle><manvolnum>5</manvolnum>
418 </citerefentry>,
419 <citerefentry>
420 <refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum>
421 </citerefentry>
422 </para>
423 </refsect1>
1ff28eae
TG
424
425</refentry>