]>
Commit | Line | Data |
---|---|---|
1 | <?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*--> | |
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> disables 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 | ||
86 | <para>See | |
87 | <citerefentry><refentrytitle>udevadm</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
88 | for diagnosing problems with <filename>.link</filename> files.</para> | |
89 | </refsect1> | |
90 | ||
91 | <refsect1> | |
92 | <title>[Match] Section Options</title> | |
93 | ||
94 | <para>A link file is said to match a device if each of the entries | |
95 | in the <literal>[Match]</literal> section matches, or if the | |
96 | section is empty. The following keys are accepted:</para> | |
97 | ||
98 | <variablelist class='network-directives'> | |
99 | <varlistentry> | |
100 | <term><varname>MACAddress=</varname></term> | |
101 | <listitem> | |
102 | <para>The hardware address.</para> | |
103 | </listitem> | |
104 | </varlistentry> | |
105 | <varlistentry> | |
106 | <term><varname>OriginalName=</varname></term> | |
107 | <listitem> | |
108 | <para>A whitespace-separated list of shell-style globs matching | |
109 | the device name, as exposed by the udev property | |
110 | "INTERFACE". This can not be used to match on names that have | |
111 | already been changed from userspace. Caution is advised when matching on | |
112 | kernel-assigned names, as they are known to be unstable | |
113 | between reboots.</para> | |
114 | </listitem> | |
115 | </varlistentry> | |
116 | <varlistentry> | |
117 | <term><varname>Path=</varname></term> | |
118 | <listitem> | |
119 | <para>A whitespace-separated list of shell-style globs matching | |
120 | the persistent path, as exposed by the udev property | |
121 | <literal>ID_PATH</literal>.</para> | |
122 | </listitem> | |
123 | </varlistentry> | |
124 | <varlistentry> | |
125 | <term><varname>Driver=</varname></term> | |
126 | <listitem> | |
127 | <para>A whitespace-separated list of shell-style globs matching | |
128 | the driver currently bound to the device, | |
129 | as exposed by the udev property <literal>DRIVER</literal> | |
130 | of its parent device, or if that is not set, the | |
131 | driver as exposed by <literal>ethtool -i</literal> | |
132 | of the device itself.</para> | |
133 | </listitem> | |
134 | </varlistentry> | |
135 | <varlistentry> | |
136 | <term><varname>Type=</varname></term> | |
137 | <listitem> | |
138 | <para>A whitespace-separated list of shell-style globs matching | |
139 | the device type, as exposed by the udev | |
140 | property <literal>DEVTYPE</literal>.</para> | |
141 | </listitem> | |
142 | </varlistentry> | |
143 | <varlistentry> | |
144 | <term><varname>Host=</varname></term> | |
145 | <listitem> | |
146 | <para>Matches against the hostname or machine | |
147 | ID of the host. See <literal>ConditionHost=</literal> in | |
148 | <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
149 | for details.</para> | |
150 | </listitem> | |
151 | </varlistentry> | |
152 | <varlistentry> | |
153 | <term><varname>Virtualization=</varname></term> | |
154 | <listitem> | |
155 | <para>Checks whether the system is executed in | |
156 | a virtualized environment and optionally test | |
157 | whether it is a specific implementation. See | |
158 | <literal>ConditionVirtualization=</literal> in | |
159 | <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
160 | for details.</para> | |
161 | </listitem> | |
162 | </varlistentry> | |
163 | <varlistentry> | |
164 | <term><varname>KernelCommandLine=</varname></term> | |
165 | <listitem> | |
166 | <para>Checks whether a specific kernel command line option | |
167 | is set (or if prefixed with the exclamation mark unset). See | |
168 | <literal>ConditionKernelCommandLine=</literal> in | |
169 | <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
170 | for details.</para> | |
171 | </listitem> | |
172 | </varlistentry> | |
173 | <varlistentry> | |
174 | <term><varname>Architecture=</varname></term> | |
175 | <listitem> | |
176 | <para>Checks whether the system is running on a specific | |
177 | architecture. See <literal>ConditionArchitecture=</literal> | |
178 | in | |
179 | <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
180 | for details.</para> | |
181 | </listitem> | |
182 | </varlistentry> | |
183 | </variablelist> | |
184 | ||
185 | </refsect1> | |
186 | ||
187 | <refsect1> | |
188 | <title>[Link] Section Options</title> | |
189 | ||
190 | <para>The <literal>[Link]</literal> section accepts the following | |
191 | keys:</para> | |
192 | ||
193 | <variablelist class='network-directives'> | |
194 | <varlistentry> | |
195 | <term><varname>Description=</varname></term> | |
196 | <listitem> | |
197 | <para>A description of the device.</para> | |
198 | </listitem> | |
199 | </varlistentry> | |
200 | <varlistentry> | |
201 | <term><varname>Alias=</varname></term> | |
202 | <listitem> | |
203 | <para>The <literal>ifalias</literal> is set to this | |
204 | value.</para> | |
205 | </listitem> | |
206 | </varlistentry> | |
207 | <varlistentry> | |
208 | <term><varname>MACAddressPolicy=</varname></term> | |
209 | <listitem> | |
210 | <para>The policy by which the MAC address should be set. The | |
211 | available policies are: | |
212 | </para> | |
213 | ||
214 | <variablelist> | |
215 | <varlistentry> | |
216 | <term><literal>persistent</literal></term> | |
217 | <listitem> | |
218 | <para>If the hardware has a persistent MAC address, as | |
219 | most hardware should, and if it is used by the kernel, | |
220 | nothing is done. Otherwise, a new MAC address is | |
221 | generated which is guaranteed to be the same on every | |
222 | boot for the given machine and the given device, but | |
223 | which is otherwise random. This feature depends on ID_NET_NAME_* | |
224 | properties to exist for the link. On hardware where these | |
225 | properties are not set, the generation of a persistent MAC address | |
226 | will fail.</para> | |
227 | </listitem> | |
228 | </varlistentry> | |
229 | <varlistentry> | |
230 | <term><literal>random</literal></term> | |
231 | <listitem> | |
232 | <para>If the kernel is using a random MAC address, | |
233 | nothing is done. Otherwise, a new address is randomly | |
234 | generated each time the device appears, typically at | |
235 | boot. Either way, the random address will have the | |
236 | <literal>unicast</literal> and | |
237 | <literal>locally administered</literal> bits set.</para> | |
238 | </listitem> | |
239 | </varlistentry> | |
240 | <varlistentry> | |
241 | <term><literal>none</literal></term> | |
242 | <listitem> | |
243 | <para>Keeps the MAC address assigned by the kernel.</para> | |
244 | </listitem> | |
245 | </varlistentry> | |
246 | </variablelist> | |
247 | </listitem> | |
248 | </varlistentry> | |
249 | <varlistentry> | |
250 | <term><varname>MACAddress=</varname></term> | |
251 | <listitem> | |
252 | <para>The MAC address to use, if no | |
253 | <literal>MACAddressPolicy=</literal> | |
254 | is specified.</para> | |
255 | </listitem> | |
256 | </varlistentry> | |
257 | <varlistentry> | |
258 | <term><varname>NamePolicy=</varname></term> | |
259 | <listitem> | |
260 | <para>An ordered, space-separated list of policies by which | |
261 | the interface name should be set. | |
262 | <literal>NamePolicy</literal> may be disabled by specifying | |
263 | <literal>net.ifnames=0</literal> on the kernel command line. | |
264 | Each of the policies may fail, and the first successful one | |
265 | is used. The name is not set directly, but is exported to | |
266 | udev as the property <literal>ID_NET_NAME</literal>, which | |
267 | is, by default, used by a udev rule to set | |
268 | <literal>NAME</literal>. If the name has already been set by | |
269 | userspace, no renaming is performed. The available policies | |
270 | are:</para> | |
271 | ||
272 | <variablelist> | |
273 | <varlistentry> | |
274 | <term><literal>kernel</literal></term> | |
275 | <listitem> | |
276 | <para>If the kernel claims that the name it has set | |
277 | for a device is predictable, then no renaming is | |
278 | performed.</para> | |
279 | </listitem> | |
280 | </varlistentry> | |
281 | <varlistentry> | |
282 | <term><literal>database</literal></term> | |
283 | <listitem> | |
284 | <para>The name is set based on entries in the udev's | |
285 | Hardware Database with the key | |
286 | <literal>ID_NET_NAME_FROM_DATABASE</literal>. | |
287 | </para> | |
288 | </listitem> | |
289 | </varlistentry> | |
290 | <varlistentry> | |
291 | <term><literal>onboard</literal></term> | |
292 | <listitem> | |
293 | <para>The name is set based on information given by | |
294 | the firmware for on-board devices, as exported by the | |
295 | udev property <literal>ID_NET_NAME_ONBOARD</literal>. | |
296 | </para> | |
297 | </listitem> | |
298 | </varlistentry> | |
299 | <varlistentry> | |
300 | <term><literal>slot</literal></term> | |
301 | <listitem> | |
302 | <para>The name is set based on information given by | |
303 | the firmware for hot-plug devices, as exported by the | |
304 | udev property <literal>ID_NET_NAME_SLOT</literal>. | |
305 | </para> | |
306 | </listitem> | |
307 | </varlistentry> | |
308 | <varlistentry> | |
309 | <term><literal>path</literal></term> | |
310 | <listitem> | |
311 | <para>The name is set based on the device's physical | |
312 | location, as exported by the udev property | |
313 | <literal>ID_NET_NAME_PATH</literal>.</para> | |
314 | </listitem> | |
315 | </varlistentry> | |
316 | <varlistentry> | |
317 | <term><literal>mac</literal></term> | |
318 | <listitem> | |
319 | <para>The name is set based on the device's persistent | |
320 | MAC address, as exported by the udev property | |
321 | <literal>ID_NET_NAME_MAC</literal>.</para> | |
322 | </listitem> | |
323 | </varlistentry> | |
324 | </variablelist> | |
325 | </listitem> | |
326 | </varlistentry> | |
327 | <varlistentry> | |
328 | <term><varname>Name=</varname></term> | |
329 | <listitem> | |
330 | <para>The interface name to use in case all the | |
331 | policies specified in | |
332 | <varname>NamePolicy=</varname> fail, or in case | |
333 | <varname>NamePolicy=</varname> is missing or | |
334 | disabled.</para> | |
335 | </listitem> | |
336 | </varlistentry> | |
337 | <varlistentry> | |
338 | <term><varname>MTUBytes=</varname></term> | |
339 | <listitem> | |
340 | <para>The maximum transmission unit in bytes to set for the | |
341 | device. The usual suffixes K, M, G, are supported and are | |
342 | understood to the base of 1024.</para> | |
343 | </listitem> | |
344 | </varlistentry> | |
345 | <varlistentry> | |
346 | <term><varname>BitsPerSecond=</varname></term> | |
347 | <listitem> | |
348 | <para>The speed to set for the device, the value is rounded | |
349 | down to the nearest Mbps. The usual suffixes K, M, G, are | |
350 | supported and are understood to the base of 1000.</para> | |
351 | </listitem> | |
352 | </varlistentry> | |
353 | <varlistentry> | |
354 | <term><varname>Duplex=</varname></term> | |
355 | <listitem> | |
356 | <para>The duplex mode to set for the device. The accepted | |
357 | values are <literal>half</literal> and | |
358 | <literal>full</literal>.</para> | |
359 | </listitem> | |
360 | </varlistentry> | |
361 | <varlistentry> | |
362 | <term><varname>WakeOnLan=</varname></term> | |
363 | <listitem> | |
364 | <para>The Wake-on-LAN policy to set for the device. The | |
365 | supported values are:</para> | |
366 | ||
367 | <variablelist> | |
368 | <varlistentry> | |
369 | <term><literal>phy</literal></term> | |
370 | <listitem> | |
371 | <para>Wake on PHY activity.</para> | |
372 | </listitem> | |
373 | </varlistentry> | |
374 | <varlistentry> | |
375 | <term><literal>magic</literal></term> | |
376 | <listitem> | |
377 | <para>Wake on receipt of a magic packet. | |
378 | </para> | |
379 | </listitem> | |
380 | </varlistentry> | |
381 | <varlistentry> | |
382 | <term><literal>off</literal></term> | |
383 | <listitem> | |
384 | <para>Never wake.</para> | |
385 | </listitem> | |
386 | </varlistentry> | |
387 | </variablelist> | |
388 | </listitem> | |
389 | </varlistentry> | |
390 | </variablelist> | |
391 | </refsect1> | |
392 | ||
393 | <refsect1> | |
394 | <title>Examples</title> | |
395 | ||
396 | <example> | |
397 | <title>/usr/lib/systemd/network/99-default.link</title> | |
398 | ||
399 | <para>The link file <filename>99-default.link</filename> that is | |
400 | shipped with systemd defines the default naming policy for | |
401 | links.</para> | |
402 | ||
403 | <programlisting>[Link] | |
404 | NamePolicy=kernel database onboard slot path | |
405 | MACAddressPolicy=persistent</programlisting> | |
406 | </example> | |
407 | ||
408 | <example> | |
409 | <title>/etc/systemd/network/10-dmz.link</title> | |
410 | ||
411 | <para>This example assigns the fixed name | |
412 | <literal>dmz0</literal> to the interface with the MAC address | |
413 | 00:a0:de:63:7a:e6:</para> | |
414 | ||
415 | <programlisting>[Match] | |
416 | MACAddress=00:a0:de:63:7a:e6 | |
417 | ||
418 | [Link] | |
419 | Name=dmz0</programlisting> | |
420 | </example> | |
421 | ||
422 | <example> | |
423 | <title>/etc/systemd/network/10-internet.link</title> | |
424 | ||
425 | <para>This example assigns the fixed name | |
426 | <literal>internet0</literal> to the interface with the device | |
427 | path <literal>pci-0000:00:1a.0-*</literal>:</para> | |
428 | ||
429 | <programlisting>[Match] | |
430 | Path=pci-0000:00:1a.0-* | |
431 | ||
432 | [Link] | |
433 | Name=internet0</programlisting> | |
434 | </example> | |
435 | ||
436 | <example> | |
437 | <title>/etc/systemd/network/25-wireless.link</title> | |
438 | ||
439 | <para>Here's an overly complex example that shows the use of a large number of [Match] and [Link] settings.</para> | |
440 | ||
441 | <programlisting>[Match] | |
442 | MACAddress=12:34:56:78:9a:bc | |
443 | Driver=brcmsmac | |
444 | Path=pci-0000:02:00.0-* | |
445 | Type=wlan | |
446 | Virtualization=no | |
447 | Host=my-laptop | |
448 | Architecture=x86-64 | |
449 | ||
450 | [Link] | |
451 | Name=wireless0 | |
452 | MTUBytes=1450 | |
453 | BitsPerSecond=10M | |
454 | WakeOnLan=magic | |
455 | MACAddress=cb:a9:87:65:43:21</programlisting> | |
456 | </example> | |
457 | </refsect1> | |
458 | ||
459 | <refsect1> | |
460 | <title>See Also</title> | |
461 | <para> | |
462 | <citerefentry> | |
463 | <refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum> | |
464 | </citerefentry>, | |
465 | <citerefentry> | |
466 | <refentrytitle>udevadm</refentrytitle><manvolnum>8</manvolnum> | |
467 | </citerefentry>, | |
468 | <citerefentry> | |
469 | <refentrytitle>systemd.netdev</refentrytitle><manvolnum>5</manvolnum> | |
470 | </citerefentry>, | |
471 | <citerefentry> | |
472 | <refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum> | |
473 | </citerefentry> | |
474 | </para> | |
475 | </refsect1> | |
476 | ||
477 | </refentry> |