]>
Commit | Line | Data |
---|---|---|
1ff28eae TG |
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 | ||
d86dd07d | 56 | <para>Network link configuration is performed by the <command>net_setup_link</command> |
1ff28eae TG |
57 | udev builtin.</para> |
58 | ||
59 | <para>The link files are read from the files located in the | |
60 | system network directory <filename>/usr/lib/systemd/network</filename>, | |
d86dd07d | 61 | the volatile runtime network directory <filename>/run/systemd/network</filename>, |
1ff28eae TG |
62 | and the local administration network directory <filename>/etc/systemd/network</filename>. |
63 | Link files must have the extension <filename>.link</filename>; other extensions are ignored. | |
64 | All link files are collectively sorted and processed in lexical order, | |
65 | regardless of the directories in which they live. However, files with | |
66 | identical filenames replace each other. Files in <filename>/etc</filename> | |
67 | have the highest priority, files in <filename>/run</filename> take precedence | |
68 | over files with the same name in <filename>/usr/lib</filename>. This can be | |
69 | used to override a system-supplied link file with a local file if needed; | |
70 | a symlink in <filename>/etc</filename> with the same name as a link file in | |
71 | <filename>/usr/lib</filename>, pointing to <filename>/dev/null</filename>, | |
72 | disables the link file entirely.</para> | |
73 | ||
74 | <para>The link file contains a <literal>[Match]</literal> section, which | |
75 | determines if a given link file may be applied to a given device; and a | |
76 | <literal>[Link]</literal> section specifying how the device should be | |
77 | configured. The first (in lexical order) of the link files that matches | |
78 | a given device is applied.</para> | |
102bd40e LP |
79 | </refsect1> |
80 | ||
81 | <refsect1> | |
82 | <title>[Match] Section Options</title> | |
1ff28eae TG |
83 | |
84 | <para>A link file is said to match a device if each of the entries in the | |
85 | <literal>[Match]</literal> section matches, or if the section is empty. | |
86 | The following keys are accepted:</para> | |
87 | ||
88 | <variablelist class='network-directives'> | |
89 | <varlistentry> | |
90 | <term><varname>MACAddress=</varname></term> | |
91 | <listitem> | |
92 | <para>The hardware address.</para> | |
93 | </listitem> | |
94 | </varlistentry> | |
7eb08da4 TG |
95 | <varlistentry> |
96 | <term><varname>OriginalName=</varname></term> | |
97 | <listitem> | |
98 | <para>The device name, as exposed by the udev | |
99 | property "INTERFACE". May contain shell style | |
100 | globs. This can not be used to match on names | |
101 | that have already been changed from userspace. | |
f131770b | 102 | Caution is advised when matching on |
7eb08da4 TG |
103 | kernel-assigned names, as they are known to |
104 | be unstable between reboots.</para> | |
105 | </listitem> | |
106 | </varlistentry> | |
1ff28eae TG |
107 | <varlistentry> |
108 | <term><varname>Path=</varname></term> | |
109 | <listitem> | |
7eb08da4 TG |
110 | <para>The persistent path, as exposed by the |
111 | udev property <literal>ID_PATH</literal>. May | |
112 | contain shell style globs.</para> | |
113 | </listitem> | |
1ff28eae TG |
114 | </varlistentry> |
115 | <varlistentry> | |
116 | <term><varname>Driver=</varname></term> | |
117 | <listitem> | |
118 | <para>The driver currently bound to the device, | |
119 | as exposed by the udev property <literal>DRIVER</literal> | |
b8bde116 | 120 | of its parent device, or if that is not set, the |
1ff28eae TG |
121 | driver as exposed by <literal>ethtool -i</literal> |
122 | of the device itself.</para> | |
123 | </listitem> | |
124 | </varlistentry> | |
125 | <varlistentry> | |
126 | <term><varname>Type=</varname></term> | |
127 | <listitem> | |
128 | <para>The device type, as exposed by the udev | |
129 | property <literal>DEVTYPE</literal>.</para> | |
130 | </listitem> | |
131 | </varlistentry> | |
132 | <varlistentry> | |
133 | <term><varname>Host=</varname></term> | |
134 | <listitem> | |
135 | <para>Matches against the hostname or machine | |
136 | ID of the host. See <literal>ConditionHost=</literal> in | |
137 | <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
138 | for details.</para> | |
139 | </listitem> | |
140 | </varlistentry> | |
141 | <varlistentry> | |
142 | <term><varname>Virtualization=</varname></term> | |
143 | <listitem> | |
144 | <para>Checks whether the system is executed in | |
145 | a virtualized environment and optionally test | |
146 | whether it is a specific implementation. See | |
147 | <literal>ConditionVirtualization=</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>KernelCommandLine=</varname></term> | |
154 | <listitem> | |
155 | <para>Checks whether a specific kernel command | |
156 | line option is set (or if prefixed with the | |
157 | exclamation mark unset). See | |
158 | <literal>ConditionKernelCommandLine=</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>Architecture=</varname></term> | |
165 | <listitem> | |
166 | <para>Checks whether the system is running on a | |
167 | specific architecture. See | |
168 | <literal>ConditionArchitecture=</literal> in | |
169 | <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
170 | for details.</para> | |
171 | </listitem> | |
172 | </varlistentry> | |
173 | </variablelist> | |
174 | ||
102bd40e LP |
175 | </refsect1> |
176 | ||
177 | <refsect1> | |
178 | <title>[Link] Section Options</title> | |
179 | ||
1ff28eae TG |
180 | <para>The <literal>[Link]</literal> section accepts the following |
181 | keys:</para> | |
182 | ||
183 | <variablelist class='network-directives'> | |
184 | <varlistentry> | |
185 | <term><varname>Description=</varname></term> | |
186 | <listitem> | |
187 | <para>A description of the device.</para> | |
188 | </listitem> | |
189 | </varlistentry> | |
190 | <varlistentry> | |
191 | <term><varname>Alias=</varname></term> | |
192 | <listitem> | |
193 | <para>The <literal>ifalias</literal> is set to | |
194 | this value.</para> | |
195 | </listitem> | |
196 | </varlistentry> | |
197 | <varlistentry> | |
198 | <term><varname>MACAddressPolicy=</varname></term> | |
199 | <listitem> | |
200 | <para>The policy by which the MAC address | |
201 | should be set. The available policies are: | |
202 | </para> | |
203 | ||
204 | <variablelist> | |
205 | <varlistentry> | |
206 | <term><literal>persistent</literal></term> | |
207 | <listitem> | |
208 | <para>If the hardware has a persistent | |
209 | MAC address, as most hardware should, | |
dca348bc | 210 | and if it is used by the kernel, nothing |
1ff28eae TG |
211 | is done. Otherwise, a new MAC address |
212 | is generated which is guaranteed to be | |
213 | the same on every boot for the given | |
214 | machine and the given device, but which | |
215 | is otherwise random.</para> | |
216 | </listitem> | |
217 | </varlistentry> | |
218 | <varlistentry> | |
219 | <term><literal>random</literal></term> | |
220 | <listitem> | |
221 | <para>If the kernel is using a random MAC | |
222 | address, nothing is done. Otherwise, a new | |
223 | address is randomly generated each time the | |
224 | device appears, typically at boot.</para> | |
225 | </listitem> | |
226 | </varlistentry> | |
227 | </variablelist> | |
228 | </listitem> | |
229 | </varlistentry> | |
230 | <varlistentry> | |
231 | <term><varname>MACAddress=</varname></term> | |
232 | <listitem> | |
233 | <para>The MAC address to use, if no | |
234 | <literal>MACAddressPolicy=</literal> | |
235 | is specified.</para> | |
236 | </listitem> | |
237 | </varlistentry> | |
238 | <varlistentry> | |
239 | <term><varname>NamePolicy=</varname></term> | |
240 | <listitem> | |
241 | <para>An ordered, space-separated list of | |
242 | policies by which the interface name should | |
243 | be set. <literal>NamePolicy</literal> may be | |
244 | disabled by specifying | |
245 | <literal>net.ifnames=0</literal> on the kernel | |
3f85ef0f | 246 | command line. Each of the policies may fail, and |
1ff28eae TG |
247 | the first successful one is used. The name is |
248 | not set directly, but is exported to udev as | |
249 | the property <literal>ID_NET_NAME</literal>, | |
250 | which is, by default, used by a udev rule to set | |
04b67d49 TG |
251 | <literal>NAME</literal>. If the name has already |
252 | been set by userspace, no renaming is performed. | |
253 | The available policies are:</para> | |
1ff28eae TG |
254 | |
255 | <variablelist> | |
04b67d49 TG |
256 | <varlistentry> |
257 | <term><literal>kernel</literal></term> | |
258 | <listitem> | |
259 | <para>If the kernel claims that the name it | |
260 | has set for a device is predictable, then | |
261 | no renaming is performed. | |
262 | </para> | |
263 | </listitem> | |
264 | </varlistentry> | |
1ff28eae TG |
265 | <varlistentry> |
266 | <term><literal>database</literal></term> | |
267 | <listitem> | |
268 | <para>The name is set based on entries in | |
269 | the udev's Hardware Database with the key | |
70a44afe JE |
270 | <literal>ID_NET_NAME_FROM_DATABASE</literal>. |
271 | </para> | |
1ff28eae TG |
272 | </listitem> |
273 | </varlistentry> | |
274 | <varlistentry> | |
275 | <term><literal>onboard</literal></term> | |
276 | <listitem> | |
277 | <para>The name is set based on information given by | |
278 | the firmware for on-board devices, as exported by | |
70a44afe JE |
279 | the udev property <literal>ID_NET_NAME_ONBOARD</literal>. |
280 | </para> | |
1ff28eae TG |
281 | </listitem> |
282 | </varlistentry> | |
283 | <varlistentry> | |
284 | <term><literal>slot</literal></term> | |
285 | <listitem> | |
286 | <para>The name is set based on information given by | |
287 | the firmware for hot-plug devices, as exported by | |
70a44afe JE |
288 | the udev property <literal>ID_NET_NAME_SLOT</literal>. |
289 | </para> | |
1ff28eae TG |
290 | </listitem> |
291 | </varlistentry> | |
292 | <varlistentry> | |
293 | <term><literal>path</literal></term> | |
294 | <listitem> | |
295 | <para>The name is set based on the device's physical | |
296 | location, as exported by the udev property | |
297 | <literal>ID_NET_NAME_PATH</literal>.</para> | |
298 | </listitem> | |
299 | </varlistentry> | |
300 | <varlistentry> | |
301 | <term><literal>mac</literal></term> | |
302 | <listitem> | |
303 | <para>The name is set based on the device's | |
304 | persistent MAC address, as exported by the udev | |
305 | property <literal>ID_NET_NAME_MAC</literal>.</para> | |
306 | </listitem> | |
307 | </varlistentry> | |
308 | </variablelist> | |
309 | </listitem> | |
310 | </varlistentry> | |
311 | <varlistentry> | |
312 | <term><varname>Name=</varname></term> | |
313 | <listitem> | |
314 | <para>The interface name to use in case all the | |
315 | policies specified in | |
316 | <varname>NamePolicy=</varname> fail, or in case | |
317 | <varname>NamePolicy=</varname> is missing or | |
318 | disabled.</para> | |
319 | </listitem> | |
320 | </varlistentry> | |
321 | <varlistentry> | |
322 | <term><varname>MTUBytes=</varname></term> | |
323 | <listitem> | |
324 | <para>The maximum transmission unit in bytes to | |
325 | set for the device. The usual suffixes K, M, G, | |
326 | are supported and are understood to the base of | |
327 | 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 | |
334 | value is rounded down to the nearest Mbps. | |
335 | The usual suffixes K, M, G, are supported and | |
336 | are understood to the base of 1000.</para> | |
337 | </listitem> | |
338 | </varlistentry> | |
339 | <varlistentry> | |
340 | <term><varname>Duplex=</varname></term> | |
341 | <listitem> | |
342 | <para>The duplex mode to set for the device. | |
343 | The accepted values are <literal>half</literal> | |
344 | and <literal>full</literal>.</para> | |
345 | </listitem> | |
346 | </varlistentry> | |
347 | <varlistentry> | |
348 | <term><varname>WakeOnLan=</varname></term> | |
349 | <listitem> | |
350 | <para>The Wake-on-LAN policy to set for the | |
351 | device. The supported values are:</para> | |
352 | ||
353 | <variablelist> | |
354 | <varlistentry> | |
355 | <term><literal>phy</literal></term> | |
356 | <listitem> | |
357 | <para>Wake on PHY activity.</para> | |
358 | </listitem> | |
359 | </varlistentry> | |
360 | <varlistentry> | |
361 | <term><literal>magic</literal></term> | |
362 | <listitem> | |
70a44afe | 363 | <para>Wake on receipt of a magic packet. |
1ff28eae TG |
364 | </para> |
365 | </listitem> | |
366 | </varlistentry> | |
367 | <varlistentry> | |
368 | <term><literal>off</literal></term> | |
369 | <listitem> | |
370 | <para>Never wake.</para> | |
371 | </listitem> | |
372 | </varlistentry> | |
373 | </variablelist> | |
374 | </listitem> | |
375 | </varlistentry> | |
376 | </variablelist> | |
377 | </refsect1> | |
378 | ||
379 | <refsect1> | |
380 | <title>Example</title> | |
381 | <example> | |
7abaad1a | 382 | <title>/etc/systemd/network/wireless.link</title> |
1ff28eae | 383 | |
7abaad1a | 384 | <programlisting>[Match] |
385 | MACAddress=12:34:56:78:9a:bc | |
386 | Driver=brcmsmac | |
387 | Path=pci-0000:02:00.0-* | |
388 | Type=wlan | |
389 | Virtualization=no | |
390 | Host=my-laptop | |
391 | Architecture=x86-64 | |
1ff28eae | 392 | |
7abaad1a | 393 | [Link] |
394 | Name=wireless0 | |
395 | MTUBytes=1450 | |
396 | BitsPerSecond=10M | |
397 | WakeOnLan=magic | |
398 | MACAddress=cb:a9:87:65:43:21</programlisting> | |
1ff28eae TG |
399 | </example> |
400 | </refsect1> | |
401 | ||
402 | <refsect1> | |
403 | <title>See Also</title> | |
404 | <para> | |
405 | <citerefentry> | |
406 | <refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum> | |
407 | </citerefentry>, | |
408 | <citerefentry> | |
409 | <refentrytitle>udevadm</refentrytitle><manvolnum>8</manvolnum> | |
410 | </citerefentry> | |
411 | </para> | |
412 | </refsect1> | |
413 | ||
414 | </refentry> |