]>
Commit | Line | Data |
---|---|---|
1ff28eae | 1 | <?xml version='1.0'?> <!--*-nxml-*--> |
1ff28eae | 2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" |
681eb9cf FB |
3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [ |
4 | <!ENTITY % entities SYSTEM "custom-entities.ent" > | |
5 | %entities; | |
6 | ]> | |
1ff28eae TG |
7 | |
8 | <!-- | |
9 | This file is part of systemd. | |
10 | ||
11 | Copyright 2014 Tom Gundersen | |
12 | ||
13 | systemd is free software; you can redistribute it and/or modify it | |
14 | under the terms of the GNU Lesser General Public License as published by | |
15 | the Free Software Foundation; either version 2.1 of the License, or | |
16 | (at your option) any later version. | |
17 | ||
18 | systemd is distributed in the hope that it will be useful, but | |
19 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
21 | Lesser General Public License for more details. | |
22 | ||
23 | You should have received a copy of the GNU Lesser General Public License | |
24 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
25 | --> | |
26 | ||
27 | <refentry id="systemd.link"> | |
798d3a52 ZJS |
28 | <refentryinfo> |
29 | <title>systemd.link</title> | |
30 | <productname>systemd</productname> | |
1ff28eae | 31 | |
798d3a52 ZJS |
32 | <authorgroup> |
33 | <author> | |
34 | <contrib>Developer</contrib> | |
35 | <firstname>Tom</firstname> | |
36 | <surname>Gundersen</surname> | |
37 | </author> | |
38 | </authorgroup> | |
39 | </refentryinfo> | |
1ff28eae | 40 | |
798d3a52 ZJS |
41 | <refmeta> |
42 | <refentrytitle>systemd.link</refentrytitle> | |
43 | <manvolnum>5</manvolnum> | |
44 | </refmeta> | |
1ff28eae | 45 | |
798d3a52 ZJS |
46 | <refnamediv> |
47 | <refname>systemd.link</refname> | |
48 | <refpurpose>Network device configuration</refpurpose> | |
49 | </refnamediv> | |
1ff28eae | 50 | |
798d3a52 ZJS |
51 | <refsynopsisdiv> |
52 | <para><filename><replaceable>link</replaceable>.link</filename></para> | |
53 | </refsynopsisdiv> | |
1ff28eae | 54 | |
798d3a52 ZJS |
55 | <refsect1> |
56 | <title>Description</title> | |
1ff28eae | 57 | |
798d3a52 ZJS |
58 | <para>Network link configuration is performed by the |
59 | <command>net_setup_link</command> udev builtin.</para> | |
1ff28eae | 60 | |
798d3a52 | 61 | <para>The link files are read from the files located in the system |
681eb9cf | 62 | network directory <filename>&rootlibexecdir;/network</filename>, |
798d3a52 ZJS |
63 | the volatile runtime network directory |
64 | <filename>/run/systemd/network</filename>, and the local | |
65 | administration network directory | |
681eb9cf | 66 | <filename>&pkgsysconfdir;/network</filename>. Link files must have |
798d3a52 ZJS |
67 | the extension <filename>.link</filename>; other extensions are |
68 | ignored. All link files are collectively sorted and processed in | |
69 | lexical order, regardless of the directories in which they live. | |
70 | However, files with identical filenames replace each other. Files | |
71 | in <filename>/etc</filename> have the highest priority, files in | |
72 | <filename>/run</filename> take precedence over files with the same | |
7d2e33a4 | 73 | name in <filename>&rootprefix;/lib</filename>. This can be used to |
798d3a52 ZJS |
74 | override a system-supplied link file with a local file if needed; |
75 | a symlink in <filename>/etc</filename> with the same name as a | |
7d2e33a4 | 76 | link file in <filename>&rootprefix;/lib</filename>, pointing to |
798d3a52 ZJS |
77 | <filename>/dev/null</filename>, disables the link file |
78 | entirely.</para> | |
1ff28eae | 79 | |
798d3a52 ZJS |
80 | <para>The link file contains a <literal>[Match]</literal> section, |
81 | which determines if a given link file may be applied to a given | |
82 | device, as well as a <literal>[Link]</literal> section specifying | |
83 | how the device should be configured. The first (in lexical order) | |
84 | of the link files that matches a given device is applied. Note | |
85 | that a default file <filename>99-default.link</filename> is | |
86 | shipped by the system, any user-supplied | |
87 | <filename>.link</filename> should hence have a lexically earlier | |
88 | name to be considered at all.</para> | |
89 | </refsect1> | |
102bd40e | 90 | |
798d3a52 ZJS |
91 | <refsect1> |
92 | <title>[Match] Section Options</title> | |
1ff28eae | 93 | |
798d3a52 ZJS |
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> | |
1ff28eae | 97 | |
798d3a52 ZJS |
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> | |
5256e00e TG |
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 | |
798d3a52 ZJS |
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> | |
5256e00e TG |
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> | |
798d3a52 ZJS |
122 | </listitem> |
123 | </varlistentry> | |
124 | <varlistentry> | |
125 | <term><varname>Driver=</varname></term> | |
126 | <listitem> | |
5256e00e TG |
127 | <para>A whitespace-separated list of shell-style globs matching |
128 | the driver currently bound to the device, | |
798d3a52 ZJS |
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> | |
5256e00e TG |
138 | <para>A whitespace-separated list of shell-style globs matching |
139 | the device type, as exposed by the udev | |
798d3a52 ZJS |
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> | |
1ff28eae | 184 | |
798d3a52 | 185 | </refsect1> |
102bd40e | 186 | |
798d3a52 ZJS |
187 | <refsect1> |
188 | <title>[Link] Section Options</title> | |
102bd40e | 189 | |
798d3a52 ZJS |
190 | <para>The <literal>[Link]</literal> section accepts the following |
191 | keys:</para> | |
1ff28eae | 192 | |
798d3a52 ZJS |
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> | |
1ff28eae | 213 | |
798d3a52 ZJS |
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 | |
1c25683e TG |
223 | which is otherwise random. This feature depends on ID_NET_NAME_* |
224 | properties existing for the link, on hardware where these | |
e2acdb6b | 225 | properties are not set the generation of a persistent MAC address |
1c25683e | 226 | will fail.</para> |
798d3a52 ZJS |
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 | |
2e229e0c TG |
235 | boot. Either way the random address will have the |
236 | <literal>unicast</literal> and | |
237 | <literal>locally administered</literal> bits set.</para> | |
798d3a52 ZJS |
238 | </listitem> |
239 | </varlistentry> | |
240 | </variablelist> | |
241 | </listitem> | |
242 | </varlistentry> | |
243 | <varlistentry> | |
244 | <term><varname>MACAddress=</varname></term> | |
245 | <listitem> | |
246 | <para>The MAC address to use, if no | |
247 | <literal>MACAddressPolicy=</literal> | |
248 | is specified.</para> | |
249 | </listitem> | |
250 | </varlistentry> | |
251 | <varlistentry> | |
252 | <term><varname>NamePolicy=</varname></term> | |
253 | <listitem> | |
254 | <para>An ordered, space-separated list of policies by which | |
255 | the interface name should be set. | |
256 | <literal>NamePolicy</literal> may be disabled by specifying | |
257 | <literal>net.ifnames=0</literal> on the kernel command line. | |
258 | Each of the policies may fail, and the first successful one | |
259 | is used. The name is not set directly, but is exported to | |
260 | udev as the property <literal>ID_NET_NAME</literal>, which | |
261 | is, by default, used by a udev rule to set | |
262 | <literal>NAME</literal>. If the name has already been set by | |
263 | userspace, no renaming is performed. The available policies | |
264 | are:</para> | |
1ff28eae | 265 | |
798d3a52 ZJS |
266 | <variablelist> |
267 | <varlistentry> | |
268 | <term><literal>kernel</literal></term> | |
269 | <listitem> | |
270 | <para>If the kernel claims that the name it has set | |
271 | for a device is predictable, then no renaming is | |
272 | performed.</para> | |
273 | </listitem> | |
274 | </varlistentry> | |
275 | <varlistentry> | |
276 | <term><literal>database</literal></term> | |
277 | <listitem> | |
278 | <para>The name is set based on entries in the udev's | |
279 | Hardware Database with the key | |
280 | <literal>ID_NET_NAME_FROM_DATABASE</literal>. | |
281 | </para> | |
282 | </listitem> | |
283 | </varlistentry> | |
284 | <varlistentry> | |
285 | <term><literal>onboard</literal></term> | |
286 | <listitem> | |
287 | <para>The name is set based on information given by | |
288 | the firmware for on-board devices, as exported by the | |
289 | udev property <literal>ID_NET_NAME_ONBOARD</literal>. | |
290 | </para> | |
291 | </listitem> | |
292 | </varlistentry> | |
293 | <varlistentry> | |
294 | <term><literal>slot</literal></term> | |
295 | <listitem> | |
296 | <para>The name is set based on information given by | |
297 | the firmware for hot-plug devices, as exported by the | |
298 | udev property <literal>ID_NET_NAME_SLOT</literal>. | |
299 | </para> | |
300 | </listitem> | |
301 | </varlistentry> | |
302 | <varlistentry> | |
303 | <term><literal>path</literal></term> | |
304 | <listitem> | |
305 | <para>The name is set based on the device's physical | |
306 | location, as exported by the udev property | |
307 | <literal>ID_NET_NAME_PATH</literal>.</para> | |
308 | </listitem> | |
309 | </varlistentry> | |
310 | <varlistentry> | |
311 | <term><literal>mac</literal></term> | |
312 | <listitem> | |
313 | <para>The name is set based on the device's persistent | |
314 | MAC address, as exported by the udev property | |
315 | <literal>ID_NET_NAME_MAC</literal>.</para> | |
316 | </listitem> | |
317 | </varlistentry> | |
318 | </variablelist> | |
319 | </listitem> | |
320 | </varlistentry> | |
321 | <varlistentry> | |
322 | <term><varname>Name=</varname></term> | |
323 | <listitem> | |
324 | <para>The interface name to use in case all the | |
325 | policies specified in | |
326 | <varname>NamePolicy=</varname> fail, or in case | |
327 | <varname>NamePolicy=</varname> is missing or | |
328 | disabled.</para> | |
329 | </listitem> | |
330 | </varlistentry> | |
331 | <varlistentry> | |
332 | <term><varname>MTUBytes=</varname></term> | |
333 | <listitem> | |
334 | <para>The maximum transmission unit in bytes to set for the | |
335 | device. The usual suffixes K, M, G, are supported and are | |
336 | understood to the base of 1024.</para> | |
337 | </listitem> | |
338 | </varlistentry> | |
339 | <varlistentry> | |
340 | <term><varname>BitsPerSecond=</varname></term> | |
341 | <listitem> | |
342 | <para>The speed to set for the device, the value is rounded | |
343 | down to the nearest Mbps. The usual suffixes K, M, G, are | |
344 | supported and are understood to the base of 1000.</para> | |
345 | </listitem> | |
346 | </varlistentry> | |
347 | <varlistentry> | |
348 | <term><varname>Duplex=</varname></term> | |
349 | <listitem> | |
350 | <para>The duplex mode to set for the device. The accepted | |
351 | values are <literal>half</literal> and | |
352 | <literal>full</literal>.</para> | |
353 | </listitem> | |
354 | </varlistentry> | |
355 | <varlistentry> | |
356 | <term><varname>WakeOnLan=</varname></term> | |
357 | <listitem> | |
358 | <para>The Wake-on-LAN policy to set for the device. The | |
359 | supported values are:</para> | |
1ff28eae | 360 | |
798d3a52 ZJS |
361 | <variablelist> |
362 | <varlistentry> | |
363 | <term><literal>phy</literal></term> | |
364 | <listitem> | |
365 | <para>Wake on PHY activity.</para> | |
366 | </listitem> | |
367 | </varlistentry> | |
368 | <varlistentry> | |
369 | <term><literal>magic</literal></term> | |
370 | <listitem> | |
371 | <para>Wake on receipt of a magic packet. | |
372 | </para> | |
373 | </listitem> | |
374 | </varlistentry> | |
375 | <varlistentry> | |
376 | <term><literal>off</literal></term> | |
377 | <listitem> | |
378 | <para>Never wake.</para> | |
379 | </listitem> | |
380 | </varlistentry> | |
381 | </variablelist> | |
382 | </listitem> | |
383 | </varlistentry> | |
384 | </variablelist> | |
385 | </refsect1> | |
1ff28eae | 386 | |
798d3a52 ZJS |
387 | <refsect1> |
388 | <title>Example</title> | |
389 | <example> | |
681eb9cf | 390 | <title>&pkgsysconfdir;/network/wireless.link</title> |
1ff28eae | 391 | |
798d3a52 | 392 | <programlisting>[Match] |
7abaad1a | 393 | MACAddress=12:34:56:78:9a:bc |
394 | Driver=brcmsmac | |
395 | Path=pci-0000:02:00.0-* | |
396 | Type=wlan | |
397 | Virtualization=no | |
398 | Host=my-laptop | |
399 | Architecture=x86-64 | |
1ff28eae | 400 | |
7abaad1a | 401 | [Link] |
402 | Name=wireless0 | |
403 | MTUBytes=1450 | |
404 | BitsPerSecond=10M | |
405 | WakeOnLan=magic | |
406 | MACAddress=cb:a9:87:65:43:21</programlisting> | |
798d3a52 ZJS |
407 | </example> |
408 | </refsect1> | |
1ff28eae | 409 | |
798d3a52 ZJS |
410 | <refsect1> |
411 | <title>See Also</title> | |
412 | <para> | |
413 | <citerefentry> | |
414 | <refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum> | |
415 | </citerefentry>, | |
416 | <citerefentry> | |
417 | <refentrytitle>udevadm</refentrytitle><manvolnum>8</manvolnum> | |
418 | </citerefentry>, | |
419 | <citerefentry> | |
420 | <refentrytitle>systemd.netdev</refentrytitle><manvolnum>5</manvolnum> | |
421 | </citerefentry>, | |
422 | <citerefentry> | |
423 | <refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum> | |
424 | </citerefentry> | |
425 | </para> | |
426 | </refsect1> | |
1ff28eae TG |
427 | |
428 | </refentry> |