chiark / gitweb /
networkd: add basic dbus API
[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.</para>
220               </listitem>
221             </varlistentry>
222             <varlistentry>
223               <term><literal>random</literal></term>
224               <listitem>
225                 <para>If the kernel is using a random MAC address,
226                 nothing is done. Otherwise, a new address is randomly
227                 generated each time the device appears, typically at
228                 boot.</para>
229               </listitem>
230             </varlistentry>
231           </variablelist>
232         </listitem>
233       </varlistentry>
234       <varlistentry>
235         <term><varname>MACAddress=</varname></term>
236         <listitem>
237           <para>The MAC address to use, if no
238           <literal>MACAddressPolicy=</literal>
239           is specified.</para>
240         </listitem>
241       </varlistentry>
242       <varlistentry>
243         <term><varname>NamePolicy=</varname></term>
244         <listitem>
245           <para>An ordered, space-separated list of policies by which
246           the interface name should be set.
247           <literal>NamePolicy</literal> may be disabled by specifying
248           <literal>net.ifnames=0</literal> on the kernel command line.
249           Each of the policies may fail, and the first successful one
250           is used. The name is not set directly, but is exported to
251           udev as the property <literal>ID_NET_NAME</literal>, which
252           is, by default, used by a udev rule to set
253           <literal>NAME</literal>. If the name has already been set by
254           userspace, no renaming is performed. The available policies
255           are:</para>
256
257           <variablelist>
258             <varlistentry>
259               <term><literal>kernel</literal></term>
260               <listitem>
261                 <para>If the kernel claims that the name it has set
262                 for a device is predictable, then no renaming is
263                 performed.</para>
264               </listitem>
265             </varlistentry>
266             <varlistentry>
267               <term><literal>database</literal></term>
268               <listitem>
269                 <para>The name is set based on entries in the udev's
270                 Hardware Database with the key
271                 <literal>ID_NET_NAME_FROM_DATABASE</literal>.
272                 </para>
273               </listitem>
274             </varlistentry>
275             <varlistentry>
276               <term><literal>onboard</literal></term>
277               <listitem>
278                 <para>The name is set based on information given by
279                 the firmware for on-board devices, as exported by the
280                 udev property <literal>ID_NET_NAME_ONBOARD</literal>.
281                 </para>
282               </listitem>
283             </varlistentry>
284             <varlistentry>
285               <term><literal>slot</literal></term>
286               <listitem>
287                 <para>The name is set based on information given by
288                 the firmware for hot-plug devices, as exported by the
289                 udev property <literal>ID_NET_NAME_SLOT</literal>.
290                 </para>
291               </listitem>
292             </varlistentry>
293             <varlistentry>
294               <term><literal>path</literal></term>
295               <listitem>
296                 <para>The name is set based on the device's physical
297                 location, as exported by the udev property
298                 <literal>ID_NET_NAME_PATH</literal>.</para>
299               </listitem>
300             </varlistentry>
301             <varlistentry>
302               <term><literal>mac</literal></term>
303               <listitem>
304                 <para>The name is set based on the device's persistent
305                 MAC address, as exported by the udev property
306                 <literal>ID_NET_NAME_MAC</literal>.</para>
307               </listitem>
308             </varlistentry>
309           </variablelist>
310         </listitem>
311       </varlistentry>
312       <varlistentry>
313         <term><varname>Name=</varname></term>
314         <listitem>
315           <para>The interface name to use in case all the
316           policies specified in
317           <varname>NamePolicy=</varname> fail, or in case
318           <varname>NamePolicy=</varname> is missing or
319           disabled.</para>
320         </listitem>
321       </varlistentry>
322       <varlistentry>
323         <term><varname>MTUBytes=</varname></term>
324         <listitem>
325           <para>The maximum transmission unit in bytes to set for the
326           device. The usual suffixes K, M, G, are supported and are
327           understood to the base of 1024.</para>
328         </listitem>
329       </varlistentry>
330       <varlistentry>
331         <term><varname>BitsPerSecond=</varname></term>
332         <listitem>
333           <para>The speed to set for the device, the value is rounded
334           down to the nearest Mbps. The usual suffixes K, M, G, are
335           supported and are understood to the base of 1000.</para>
336         </listitem>
337       </varlistentry>
338       <varlistentry>
339         <term><varname>Duplex=</varname></term>
340         <listitem>
341           <para>The duplex mode to set for the device. The accepted
342           values are <literal>half</literal> and
343           <literal>full</literal>.</para>
344         </listitem>
345       </varlistentry>
346       <varlistentry>
347         <term><varname>WakeOnLan=</varname></term>
348         <listitem>
349           <para>The Wake-on-LAN policy to set for the device. The
350           supported values are:</para>
351
352           <variablelist>
353             <varlistentry>
354               <term><literal>phy</literal></term>
355               <listitem>
356                 <para>Wake on PHY activity.</para>
357               </listitem>
358             </varlistentry>
359             <varlistentry>
360               <term><literal>magic</literal></term>
361               <listitem>
362                 <para>Wake on receipt of a magic packet.
363                 </para>
364               </listitem>
365             </varlistentry>
366             <varlistentry>
367               <term><literal>off</literal></term>
368               <listitem>
369                 <para>Never wake.</para>
370               </listitem>
371             </varlistentry>
372           </variablelist>
373         </listitem>
374       </varlistentry>
375     </variablelist>
376   </refsect1>
377
378   <refsect1>
379     <title>Example</title>
380     <example>
381       <title>/etc/systemd/network/wireless.link</title>
382
383       <programlisting>[Match]
384 MACAddress=12:34:56:78:9a:bc
385 Driver=brcmsmac
386 Path=pci-0000:02:00.0-*
387 Type=wlan
388 Virtualization=no
389 Host=my-laptop
390 Architecture=x86-64
391
392 [Link]
393 Name=wireless0
394 MTUBytes=1450
395 BitsPerSecond=10M
396 WakeOnLan=magic
397 MACAddress=cb:a9:87:65:43:21</programlisting>
398     </example>
399   </refsect1>
400
401   <refsect1>
402     <title>See Also</title>
403     <para>
404       <citerefentry>
405         <refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum>
406       </citerefentry>,
407       <citerefentry>
408         <refentrytitle>udevadm</refentrytitle><manvolnum>8</manvolnum>
409       </citerefentry>,
410       <citerefentry>
411         <refentrytitle>systemd.netdev</refentrytitle><manvolnum>5</manvolnum>
412       </citerefentry>,
413       <citerefentry>
414         <refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum>
415       </citerefentry>
416     </para>
417   </refsect1>
418
419 </refentry>