chiark / gitweb /
afc0ad8c5e1e6d303747ec63859a20fe6c7e2ef4
[elogind.git] / man / systemd.link.xml
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">
5
6 <!--
7   This file is part of systemd.
8
9   Copyright 2014 Tom Gundersen
10
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.
15
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.
20
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/>.
23 -->
24
25 <refentry id="systemd.link">
26   <refentryinfo>
27     <title>systemd.link</title>
28     <productname>systemd</productname>
29
30     <authorgroup>
31       <author>
32         <contrib>Developer</contrib>
33         <firstname>Tom</firstname>
34         <surname>Gundersen</surname>
35       </author>
36     </authorgroup>
37   </refentryinfo>
38
39   <refmeta>
40     <refentrytitle>systemd.link</refentrytitle>
41     <manvolnum>5</manvolnum>
42   </refmeta>
43
44   <refnamediv>
45     <refname>systemd.link</refname>
46     <refpurpose>Network device configuration</refpurpose>
47   </refnamediv>
48
49   <refsynopsisdiv>
50     <para><filename><replaceable>link</replaceable>.link</filename></para>
51   </refsynopsisdiv>
52
53   <refsect1>
54     <title>Description</title>
55
56     <para>Network link configuration is performed by the
57     <command>net_setup_link</command> udev builtin.</para>
58
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
76     entirely.</para>
77
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>
87   </refsect1>
88
89   <refsect1>
90     <title>[Match] Section Options</title>
91
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>
95
96     <variablelist class='network-directives'>
97       <varlistentry>
98         <term><varname>MACAddress=</varname></term>
99         <listitem>
100           <para>The hardware address.</para>
101         </listitem>
102       </varlistentry>
103       <varlistentry>
104         <term><varname>OriginalName=</varname></term>
105         <listitem>
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>
112         </listitem>
113       </varlistentry>
114       <varlistentry>
115         <term><varname>Path=</varname></term>
116         <listitem>
117           <para>The persistent path, as exposed by the
118           udev property <literal>ID_PATH</literal>. May
119           contain shell style globs.</para>
120         </listitem>
121       </varlistentry>
122       <varlistentry>
123         <term><varname>Driver=</varname></term>
124         <listitem>
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>
130         </listitem>
131       </varlistentry>
132       <varlistentry>
133         <term><varname>Type=</varname></term>
134         <listitem>
135           <para>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.</para>
232               </listitem>
233             </varlistentry>
234           </variablelist>
235         </listitem>
236       </varlistentry>
237       <varlistentry>
238         <term><varname>MACAddress=</varname></term>
239         <listitem>
240           <para>The MAC address to use, if no
241           <literal>MACAddressPolicy=</literal>
242           is specified.</para>
243         </listitem>
244       </varlistentry>
245       <varlistentry>
246         <term><varname>NamePolicy=</varname></term>
247         <listitem>
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
258           are:</para>
259
260           <variablelist>
261             <varlistentry>
262               <term><literal>kernel</literal></term>
263               <listitem>
264                 <para>If the kernel claims that the name it has set
265                 for a device is predictable, then no renaming is
266                 performed.</para>
267               </listitem>
268             </varlistentry>
269             <varlistentry>
270               <term><literal>database</literal></term>
271               <listitem>
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>.
275                 </para>
276               </listitem>
277             </varlistentry>
278             <varlistentry>
279               <term><literal>onboard</literal></term>
280               <listitem>
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>.
284                 </para>
285               </listitem>
286             </varlistentry>
287             <varlistentry>
288               <term><literal>slot</literal></term>
289               <listitem>
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>.
293                 </para>
294               </listitem>
295             </varlistentry>
296             <varlistentry>
297               <term><literal>path</literal></term>
298               <listitem>
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>
302               </listitem>
303             </varlistentry>
304             <varlistentry>
305               <term><literal>mac</literal></term>
306               <listitem>
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>
310               </listitem>
311             </varlistentry>
312           </variablelist>
313         </listitem>
314       </varlistentry>
315       <varlistentry>
316         <term><varname>Name=</varname></term>
317         <listitem>
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
322           disabled.</para>
323         </listitem>
324       </varlistentry>
325       <varlistentry>
326         <term><varname>MTUBytes=</varname></term>
327         <listitem>
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>
331         </listitem>
332       </varlistentry>
333       <varlistentry>
334         <term><varname>BitsPerSecond=</varname></term>
335         <listitem>
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>
339         </listitem>
340       </varlistentry>
341       <varlistentry>
342         <term><varname>Duplex=</varname></term>
343         <listitem>
344           <para>The duplex mode to set for the device. The accepted
345           values are <literal>half</literal> and
346           <literal>full</literal>.</para>
347         </listitem>
348       </varlistentry>
349       <varlistentry>
350         <term><varname>WakeOnLan=</varname></term>
351         <listitem>
352           <para>The Wake-on-LAN policy to set for the device. The
353           supported values are:</para>
354
355           <variablelist>
356             <varlistentry>
357               <term><literal>phy</literal></term>
358               <listitem>
359                 <para>Wake on PHY activity.</para>
360               </listitem>
361             </varlistentry>
362             <varlistentry>
363               <term><literal>magic</literal></term>
364               <listitem>
365                 <para>Wake on receipt of a magic packet.
366                 </para>
367               </listitem>
368             </varlistentry>
369             <varlistentry>
370               <term><literal>off</literal></term>
371               <listitem>
372                 <para>Never wake.</para>
373               </listitem>
374             </varlistentry>
375           </variablelist>
376         </listitem>
377       </varlistentry>
378     </variablelist>
379   </refsect1>
380
381   <refsect1>
382     <title>Example</title>
383     <example>
384       <title>/etc/systemd/network/wireless.link</title>
385
386       <programlisting>[Match]
387 MACAddress=12:34:56:78:9a:bc
388 Driver=brcmsmac
389 Path=pci-0000:02:00.0-*
390 Type=wlan
391 Virtualization=no
392 Host=my-laptop
393 Architecture=x86-64
394
395 [Link]
396 Name=wireless0
397 MTUBytes=1450
398 BitsPerSecond=10M
399 WakeOnLan=magic
400 MACAddress=cb:a9:87:65:43:21</programlisting>
401     </example>
402   </refsect1>
403
404   <refsect1>
405     <title>See Also</title>
406     <para>
407       <citerefentry>
408         <refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum>
409       </citerefentry>,
410       <citerefentry>
411         <refentrytitle>udevadm</refentrytitle><manvolnum>8</manvolnum>
412       </citerefentry>,
413       <citerefentry>
414         <refentrytitle>systemd.netdev</refentrytitle><manvolnum>5</manvolnum>
415       </citerefentry>,
416       <citerefentry>
417         <refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum>
418       </citerefentry>
419     </para>
420   </refsect1>
421
422 </refentry>