]>
Commit | Line | Data |
---|---|---|
1ff28eae | 1 | <?xml version='1.0'?> <!--*-nxml-*--> |
1ff28eae | 2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" |
12b42c76 | 3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> |
1ff28eae TG |
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"> | |
798d3a52 ZJS |
25 | <refentryinfo> |
26 | <title>systemd.link</title> | |
27 | <productname>systemd</productname> | |
1ff28eae | 28 | |
798d3a52 ZJS |
29 | <authorgroup> |
30 | <author> | |
31 | <contrib>Developer</contrib> | |
32 | <firstname>Tom</firstname> | |
33 | <surname>Gundersen</surname> | |
34 | </author> | |
35 | </authorgroup> | |
36 | </refentryinfo> | |
1ff28eae | 37 | |
798d3a52 ZJS |
38 | <refmeta> |
39 | <refentrytitle>systemd.link</refentrytitle> | |
40 | <manvolnum>5</manvolnum> | |
41 | </refmeta> | |
1ff28eae | 42 | |
798d3a52 ZJS |
43 | <refnamediv> |
44 | <refname>systemd.link</refname> | |
45 | <refpurpose>Network device configuration</refpurpose> | |
46 | </refnamediv> | |
1ff28eae | 47 | |
798d3a52 ZJS |
48 | <refsynopsisdiv> |
49 | <para><filename><replaceable>link</replaceable>.link</filename></para> | |
50 | </refsynopsisdiv> | |
1ff28eae | 51 | |
798d3a52 ZJS |
52 | <refsect1> |
53 | <title>Description</title> | |
1ff28eae | 54 | |
798d3a52 ZJS |
55 | <para>Network link configuration is performed by the |
56 | <command>net_setup_link</command> udev builtin.</para> | |
1ff28eae | 57 | |
798d3a52 | 58 | <para>The link files are read from the files located in the system |
12b42c76 | 59 | network directory <filename>/usr/lib/systemd/network</filename>, |
798d3a52 ZJS |
60 | the volatile runtime network directory |
61 | <filename>/run/systemd/network</filename>, and the local | |
62 | administration network directory | |
12b42c76 | 63 | <filename>/etc/systemd/network</filename>. Link files must have |
798d3a52 ZJS |
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 | |
12b42c76 | 70 | name in <filename>/usr/lib</filename>. This can be used to |
57e27ec0 ZJS |
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 | |
a8eaaee7 | 73 | same name pointing to <filename>/dev/null</filename> disables the |
57e27ec0 | 74 | configuration file entirely (it is "masked").</para> |
1ff28eae | 75 | |
798d3a52 ZJS |
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 | </refsect1> | |
102bd40e | 86 | |
798d3a52 ZJS |
87 | <refsect1> |
88 | <title>[Match] Section Options</title> | |
1ff28eae | 89 | |
798d3a52 ZJS |
90 | <para>A link file is said to match a device if each of the entries |
91 | in the <literal>[Match]</literal> section matches, or if the | |
92 | section is empty. The following keys are accepted:</para> | |
1ff28eae | 93 | |
798d3a52 ZJS |
94 | <variablelist class='network-directives'> |
95 | <varlistentry> | |
96 | <term><varname>MACAddress=</varname></term> | |
97 | <listitem> | |
98 | <para>The hardware address.</para> | |
99 | </listitem> | |
100 | </varlistentry> | |
101 | <varlistentry> | |
102 | <term><varname>OriginalName=</varname></term> | |
103 | <listitem> | |
5256e00e TG |
104 | <para>A whitespace-separated list of shell-style globs matching |
105 | the device name, as exposed by the udev property | |
106 | "INTERFACE". This can not be used to match on names that have | |
107 | already been changed from userspace. Caution is advised when matching on | |
798d3a52 ZJS |
108 | kernel-assigned names, as they are known to be unstable |
109 | between reboots.</para> | |
110 | </listitem> | |
111 | </varlistentry> | |
112 | <varlistentry> | |
113 | <term><varname>Path=</varname></term> | |
114 | <listitem> | |
5256e00e TG |
115 | <para>A whitespace-separated list of shell-style globs matching |
116 | the persistent path, as exposed by the udev property | |
117 | <literal>ID_PATH</literal>.</para> | |
798d3a52 ZJS |
118 | </listitem> |
119 | </varlistentry> | |
120 | <varlistentry> | |
121 | <term><varname>Driver=</varname></term> | |
122 | <listitem> | |
5256e00e TG |
123 | <para>A whitespace-separated list of shell-style globs matching |
124 | the driver currently bound to the device, | |
798d3a52 ZJS |
125 | as exposed by the udev property <literal>DRIVER</literal> |
126 | of its parent device, or if that is not set, the | |
127 | driver as exposed by <literal>ethtool -i</literal> | |
128 | of the device itself.</para> | |
129 | </listitem> | |
130 | </varlistentry> | |
131 | <varlistentry> | |
132 | <term><varname>Type=</varname></term> | |
133 | <listitem> | |
5256e00e TG |
134 | <para>A whitespace-separated list of shell-style globs matching |
135 | the device type, as exposed by the udev | |
798d3a52 ZJS |
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> | |
1ff28eae | 180 | |
798d3a52 | 181 | </refsect1> |
102bd40e | 182 | |
798d3a52 ZJS |
183 | <refsect1> |
184 | <title>[Link] Section Options</title> | |
102bd40e | 185 | |
798d3a52 ZJS |
186 | <para>The <literal>[Link]</literal> section accepts the following |
187 | keys:</para> | |
1ff28eae | 188 | |
798d3a52 ZJS |
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> | |
1ff28eae | 209 | |
798d3a52 ZJS |
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 | |
1c25683e | 219 | which is otherwise random. This feature depends on ID_NET_NAME_* |
a8eaaee7 | 220 | properties to exist for the link. On hardware where these |
b938cb90 | 221 | properties are not set, the generation of a persistent MAC address |
1c25683e | 222 | will fail.</para> |
798d3a52 ZJS |
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 | |
b938cb90 | 231 | boot. Either way, the random address will have the |
2e229e0c TG |
232 | <literal>unicast</literal> and |
233 | <literal>locally administered</literal> bits set.</para> | |
798d3a52 ZJS |
234 | </listitem> |
235 | </varlistentry> | |
66d3752e JK |
236 | <varlistentry> |
237 | <term><literal>none</literal></term> | |
238 | <listitem> | |
239 | <para>Keeps the MAC address assigned by the kernel.</para> | |
240 | </listitem> | |
241 | </varlistentry> | |
798d3a52 ZJS |
242 | </variablelist> |
243 | </listitem> | |
244 | </varlistentry> | |
245 | <varlistentry> | |
246 | <term><varname>MACAddress=</varname></term> | |
247 | <listitem> | |
248 | <para>The MAC address to use, if no | |
249 | <literal>MACAddressPolicy=</literal> | |
250 | is specified.</para> | |
251 | </listitem> | |
252 | </varlistentry> | |
253 | <varlistentry> | |
254 | <term><varname>NamePolicy=</varname></term> | |
255 | <listitem> | |
256 | <para>An ordered, space-separated list of policies by which | |
257 | the interface name should be set. | |
258 | <literal>NamePolicy</literal> may be disabled by specifying | |
259 | <literal>net.ifnames=0</literal> on the kernel command line. | |
260 | Each of the policies may fail, and the first successful one | |
261 | is used. The name is not set directly, but is exported to | |
262 | udev as the property <literal>ID_NET_NAME</literal>, which | |
263 | is, by default, used by a udev rule to set | |
264 | <literal>NAME</literal>. If the name has already been set by | |
265 | userspace, no renaming is performed. The available policies | |
266 | are:</para> | |
1ff28eae | 267 | |
798d3a52 ZJS |
268 | <variablelist> |
269 | <varlistentry> | |
270 | <term><literal>kernel</literal></term> | |
271 | <listitem> | |
272 | <para>If the kernel claims that the name it has set | |
273 | for a device is predictable, then no renaming is | |
274 | performed.</para> | |
275 | </listitem> | |
276 | </varlistentry> | |
277 | <varlistentry> | |
278 | <term><literal>database</literal></term> | |
279 | <listitem> | |
280 | <para>The name is set based on entries in the udev's | |
281 | Hardware Database with the key | |
282 | <literal>ID_NET_NAME_FROM_DATABASE</literal>. | |
283 | </para> | |
284 | </listitem> | |
285 | </varlistentry> | |
286 | <varlistentry> | |
287 | <term><literal>onboard</literal></term> | |
288 | <listitem> | |
289 | <para>The name is set based on information given by | |
290 | the firmware for on-board devices, as exported by the | |
291 | udev property <literal>ID_NET_NAME_ONBOARD</literal>. | |
292 | </para> | |
293 | </listitem> | |
294 | </varlistentry> | |
295 | <varlistentry> | |
296 | <term><literal>slot</literal></term> | |
297 | <listitem> | |
298 | <para>The name is set based on information given by | |
299 | the firmware for hot-plug devices, as exported by the | |
300 | udev property <literal>ID_NET_NAME_SLOT</literal>. | |
301 | </para> | |
302 | </listitem> | |
303 | </varlistentry> | |
304 | <varlistentry> | |
305 | <term><literal>path</literal></term> | |
306 | <listitem> | |
307 | <para>The name is set based on the device's physical | |
308 | location, as exported by the udev property | |
309 | <literal>ID_NET_NAME_PATH</literal>.</para> | |
310 | </listitem> | |
311 | </varlistentry> | |
312 | <varlistentry> | |
313 | <term><literal>mac</literal></term> | |
314 | <listitem> | |
315 | <para>The name is set based on the device's persistent | |
316 | MAC address, as exported by the udev property | |
317 | <literal>ID_NET_NAME_MAC</literal>.</para> | |
318 | </listitem> | |
319 | </varlistentry> | |
320 | </variablelist> | |
321 | </listitem> | |
322 | </varlistentry> | |
323 | <varlistentry> | |
324 | <term><varname>Name=</varname></term> | |
325 | <listitem> | |
326 | <para>The interface name to use in case all the | |
327 | policies specified in | |
328 | <varname>NamePolicy=</varname> fail, or in case | |
329 | <varname>NamePolicy=</varname> is missing or | |
330 | disabled.</para> | |
331 | </listitem> | |
332 | </varlistentry> | |
333 | <varlistentry> | |
334 | <term><varname>MTUBytes=</varname></term> | |
335 | <listitem> | |
336 | <para>The maximum transmission unit in bytes to set for the | |
337 | device. The usual suffixes K, M, G, are supported and are | |
338 | understood to the base of 1024.</para> | |
339 | </listitem> | |
340 | </varlistentry> | |
341 | <varlistentry> | |
342 | <term><varname>BitsPerSecond=</varname></term> | |
343 | <listitem> | |
344 | <para>The speed to set for the device, the value is rounded | |
345 | down to the nearest Mbps. The usual suffixes K, M, G, are | |
346 | supported and are understood to the base of 1000.</para> | |
347 | </listitem> | |
348 | </varlistentry> | |
349 | <varlistentry> | |
350 | <term><varname>Duplex=</varname></term> | |
351 | <listitem> | |
352 | <para>The duplex mode to set for the device. The accepted | |
353 | values are <literal>half</literal> and | |
354 | <literal>full</literal>.</para> | |
355 | </listitem> | |
356 | </varlistentry> | |
357 | <varlistentry> | |
358 | <term><varname>WakeOnLan=</varname></term> | |
359 | <listitem> | |
360 | <para>The Wake-on-LAN policy to set for the device. The | |
361 | supported values are:</para> | |
1ff28eae | 362 | |
798d3a52 ZJS |
363 | <variablelist> |
364 | <varlistentry> | |
365 | <term><literal>phy</literal></term> | |
366 | <listitem> | |
367 | <para>Wake on PHY activity.</para> | |
368 | </listitem> | |
369 | </varlistentry> | |
370 | <varlistentry> | |
371 | <term><literal>magic</literal></term> | |
372 | <listitem> | |
373 | <para>Wake on receipt of a magic packet. | |
374 | </para> | |
375 | </listitem> | |
376 | </varlistentry> | |
377 | <varlistentry> | |
378 | <term><literal>off</literal></term> | |
379 | <listitem> | |
380 | <para>Never wake.</para> | |
381 | </listitem> | |
382 | </varlistentry> | |
383 | </variablelist> | |
384 | </listitem> | |
385 | </varlistentry> | |
386 | </variablelist> | |
387 | </refsect1> | |
1ff28eae | 388 | |
798d3a52 ZJS |
389 | <refsect1> |
390 | <title>Example</title> | |
391 | <example> | |
6c1695be | 392 | <title>/etc/systemd/network/25-wireless.link</title> |
1ff28eae | 393 | |
798d3a52 | 394 | <programlisting>[Match] |
7abaad1a | 395 | MACAddress=12:34:56:78:9a:bc |
396 | Driver=brcmsmac | |
397 | Path=pci-0000:02:00.0-* | |
398 | Type=wlan | |
399 | Virtualization=no | |
400 | Host=my-laptop | |
401 | Architecture=x86-64 | |
1ff28eae | 402 | |
7abaad1a | 403 | [Link] |
404 | Name=wireless0 | |
405 | MTUBytes=1450 | |
406 | BitsPerSecond=10M | |
407 | WakeOnLan=magic | |
408 | MACAddress=cb:a9:87:65:43:21</programlisting> | |
798d3a52 ZJS |
409 | </example> |
410 | </refsect1> | |
1ff28eae | 411 | |
798d3a52 ZJS |
412 | <refsect1> |
413 | <title>See Also</title> | |
414 | <para> | |
415 | <citerefentry> | |
416 | <refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum> | |
417 | </citerefentry>, | |
418 | <citerefentry> | |
419 | <refentrytitle>udevadm</refentrytitle><manvolnum>8</manvolnum> | |
420 | </citerefentry>, | |
421 | <citerefentry> | |
422 | <refentrytitle>systemd.netdev</refentrytitle><manvolnum>5</manvolnum> | |
423 | </citerefentry>, | |
424 | <citerefentry> | |
425 | <refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum> | |
426 | </citerefentry> | |
427 | </para> | |
428 | </refsect1> | |
1ff28eae TG |
429 | |
430 | </refentry> |