]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd.link.xml
ea744bd2517a7d3f829a402a1658f2dfb0aec2cd
[thirdparty/systemd.git] / man / systemd.link.xml
1 <?xml version='1.0'?>
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1+ -->
5
6 <refentry id="systemd.link">
7 <refentryinfo>
8 <title>systemd.link</title>
9 <productname>systemd</productname>
10 </refentryinfo>
11
12 <refmeta>
13 <refentrytitle>systemd.link</refentrytitle>
14 <manvolnum>5</manvolnum>
15 </refmeta>
16
17 <refnamediv>
18 <refname>systemd.link</refname>
19 <refpurpose>Network device configuration</refpurpose>
20 </refnamediv>
21
22 <refsynopsisdiv>
23 <para><filename><replaceable>link</replaceable>.link</filename></para>
24 </refsynopsisdiv>
25
26 <refsect1>
27 <title>Description</title>
28
29 <para>Network link configuration is performed by the
30 <command>net_setup_link</command> udev builtin.</para>
31
32 <para>The link files are read from the files located in the system
33 network directory <filename>/usr/lib/systemd/network</filename>,
34 the volatile runtime network directory
35 <filename>/run/systemd/network</filename>, and the local
36 administration network directory
37 <filename>/etc/systemd/network</filename>. Link files must have
38 the extension <filename>.link</filename>; other extensions are
39 ignored. All link files are collectively sorted and processed in
40 lexical order, regardless of the directories in which they live.
41 However, files with identical filenames replace each other. Files
42 in <filename>/etc</filename> have the highest priority, files in
43 <filename>/run</filename> take precedence over files with the same
44 name in <filename>/usr/lib</filename>. This can be used to
45 override a system-supplied link file with a local file if needed.
46 As a special case, an empty file (file size 0) or symlink with the
47 same name pointing to <filename>/dev/null</filename> disables the
48 configuration file entirely (it is "masked").</para>
49
50 <para>The link file contains a [Match] section, which determines if a given link file may be applied to a
51 given device, as well as a [Link] section specifying how the device should be configured. The first (in
52 lexical order) of the link files that matches a given device is applied. Note that a default file
53 <filename>99-default.link</filename> is shipped by the system. Any user-supplied
54 <filename>.link</filename> should hence have a lexically earlier name to be considered at all.</para>
55
56 <para>See <citerefentry><refentrytitle>udevadm</refentrytitle><manvolnum>8</manvolnum></citerefentry> for
57 diagnosing problems with <filename>.link</filename> files.</para>
58 </refsect1>
59
60 <refsect1>
61 <title>[Match] Section Options</title>
62
63 <para>A link file is said to match a device if all matches specified by the
64 <literal>[Match]</literal> section are satisfied. When a link file does not contain valid settings
65 in <literal>[Match]</literal> section, then the file will match all devices and
66 <command>systemd-udevd</command> warns about that. Hint: to avoid the warning and to make it clear
67 that all interfaces shall be matched, add the following:
68 <programlisting>OriginalName=*</programlisting>
69 The following keys are accepted:</para>
70
71 <variablelist class='network-directives'>
72 <varlistentry>
73 <term><varname>MACAddress=</varname></term>
74 <listitem>
75 <para>A whitespace-separated list of hardware addresses. Use full colon-, hyphen- or dot-delimited hexadecimal. See the example below.
76 This option may appear more than once, in which case the lists are merged. If the empty string is assigned to this option, the list
77 of hardware addresses defined prior to this is reset.</para>
78
79 <para>Example:
80 <programlisting>MACAddress=01:23:45:67:89:ab 00-11-22-33-44-55 AABB.CCDD.EEFF</programlisting></para>
81 </listitem>
82 </varlistentry>
83 <varlistentry>
84 <term><varname>OriginalName=</varname></term>
85 <listitem>
86 <para>A whitespace-separated list of shell-style globs matching
87 the device name, as exposed by the udev property
88 "INTERFACE". This cannot be used to match on names that have
89 already been changed from userspace. Caution is advised when matching on
90 kernel-assigned names, as they are known to be unstable
91 between reboots.</para>
92 </listitem>
93 </varlistentry>
94 <varlistentry>
95 <term><varname>Path=</varname></term>
96 <listitem>
97 <para>A whitespace-separated list of shell-style globs matching
98 the persistent path, as exposed by the udev property
99 <varname>ID_PATH</varname>.</para>
100 </listitem>
101 </varlistentry>
102 <varlistentry>
103 <term><varname>Driver=</varname></term>
104 <listitem>
105 <para>A whitespace-separated list of shell-style globs matching the driver currently bound to the
106 device, as exposed by the udev property <varname>DRIVER</varname> of its parent device, or if that
107 is not set, the driver as exposed by <command>ethtool -i</command> of the device itself.</para>
108 </listitem>
109 </varlistentry>
110 <varlistentry>
111 <term><varname>Type=</varname></term>
112 <listitem>
113 <para>A whitespace-separated list of shell-style globs matching
114 the device type, as exposed by the udev
115 property <varname>DEVTYPE</varname>.</para>
116 </listitem>
117 </varlistentry>
118 <varlistentry>
119 <term><varname>Host=</varname></term>
120 <listitem>
121 <para>Matches against the hostname or machine ID of the host. See <varname>ConditionHost=</varname> in
122 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
123 for details. When prefixed with an exclamation mark (<literal>!</literal>), the result is negated.
124 If an empty string is assigned, then previously assigned value is cleared.
125 </para>
126 </listitem>
127 </varlistentry>
128 <varlistentry>
129 <term><varname>Virtualization=</varname></term>
130 <listitem>
131 <para>Checks whether the system is executed in a virtualized environment and optionally test
132 whether it is a specific implementation. See <varname>ConditionVirtualization=</varname> in
133 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
134 for details. When prefixed with an exclamation mark (<literal>!</literal>), the result is negated.
135 If an empty string is assigned, then previously assigned value is cleared.
136 </para>
137 </listitem>
138 </varlistentry>
139 <varlistentry>
140 <term><varname>KernelCommandLine=</varname></term>
141 <listitem>
142 <para>Checks whether a specific kernel command line option is set. See
143 <varname>ConditionKernelCommandLine=</varname> in
144 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
145 for details. When prefixed with an exclamation mark (<literal>!</literal>), the result is negated.
146 If an empty string is assigned, then previously assigned value is cleared.
147 </para>
148 </listitem>
149 </varlistentry>
150 <varlistentry>
151 <term><varname>KernelVersion=</varname></term>
152 <listitem>
153 <para>Checks whether the kernel version (as reported by <command>uname -r</command>) matches a certain
154 expression. See <varname>ConditionKernelVersion=</varname> in
155 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry> for
156 details. When prefixed with an exclamation mark (<literal>!</literal>), the result is negated.
157 If an empty string is assigned, then previously assigned value is cleared.
158 </para>
159 </listitem>
160 </varlistentry>
161 <varlistentry>
162 <term><varname>Architecture=</varname></term>
163 <listitem>
164 <para>Checks whether the system is running on a specific architecture. See
165 <varname>ConditionArchitecture=</varname> in
166 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
167 for details. When prefixed with an exclamation mark (<literal>!</literal>), the result is negated.
168 If an empty string is assigned, then previously assigned value is cleared.
169 </para>
170 </listitem>
171 </varlistentry>
172 </variablelist>
173
174 </refsect1>
175
176 <refsect1>
177 <title>[Link] Section Options</title>
178
179 <para>The [Link] section accepts the following
180 keys:</para>
181
182 <variablelist class='network-directives'>
183 <varlistentry>
184 <term><varname>Description=</varname></term>
185 <listitem>
186 <para>A description of the device.</para>
187 </listitem>
188 </varlistentry>
189 <varlistentry>
190 <term><varname>Alias=</varname></term>
191 <listitem>
192 <para>The <varname>ifalias</varname> interface property is set to this value.</para>
193 </listitem>
194 </varlistentry>
195 <varlistentry>
196 <term><varname>MACAddressPolicy=</varname></term>
197 <listitem>
198 <para>The policy by which the MAC address should be set. The
199 available policies are:
200 </para>
201
202 <variablelist>
203 <varlistentry>
204 <term><option>persistent</option></term>
205 <listitem>
206 <para>If the hardware has a persistent MAC address, as
207 most hardware should, and if it is used by the kernel,
208 nothing is done. Otherwise, a new MAC address is
209 generated which is guaranteed to be the same on every
210 boot for the given machine and the given device, but
211 which is otherwise random. This feature depends on ID_NET_NAME_*
212 properties to exist for the link. On hardware where these
213 properties are not set, the generation of a persistent MAC address
214 will fail.</para>
215 </listitem>
216 </varlistentry>
217 <varlistentry>
218 <term><option>random</option></term>
219 <listitem>
220 <para>If the kernel is using a random MAC address,
221 nothing is done. Otherwise, a new address is randomly
222 generated each time the device appears, typically at
223 boot. Either way, the random address will have the
224 <literal>unicast</literal> and
225 <literal>locally administered</literal> bits set.</para>
226 </listitem>
227 </varlistentry>
228 <varlistentry>
229 <term><option>none</option></term>
230 <listitem>
231 <para>Keeps the MAC address assigned by the kernel.</para>
232 </listitem>
233 </varlistentry>
234 </variablelist>
235 </listitem>
236 </varlistentry>
237 <varlistentry>
238 <term><varname>MACAddress=</varname></term>
239 <listitem>
240 <para>The MAC address to use, if no
241 <varname>MACAddressPolicy=</varname>
242 is specified.</para>
243 </listitem>
244 </varlistentry>
245 <varlistentry>
246 <term><varname>NamePolicy=</varname></term>
247 <listitem>
248 <para>An ordered, space-separated list of policies by which the interface name should be set.
249 <varname>NamePolicy=</varname> may be disabled by specifying <option>net.ifnames=0</option> on the
250 kernel command line. Each of the policies may fail, and the first successful one is used. The name
251 is not set directly, but is exported to udev as the property <option>ID_NET_NAME</option>, which
252 is, by default, used by a
253 <citerefentry><refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
254 rule to set <varname>NAME</varname>. The available policies are:
255 </para>
256
257 <variablelist>
258 <varlistentry>
259 <term><option>kernel</option></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><option>database</option></term>
268 <listitem>
269 <para>The name is set based on entries in the udev's
270 Hardware Database with the key
271 <varname>ID_NET_NAME_FROM_DATABASE</varname>.
272 </para>
273 </listitem>
274 </varlistentry>
275 <varlistentry>
276 <term><option>onboard</option></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 <varname>ID_NET_NAME_ONBOARD</varname>.
281 </para>
282 </listitem>
283 </varlistentry>
284 <varlistentry>
285 <term><option>slot</option></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 <varname>ID_NET_NAME_SLOT</varname>.
290 </para>
291 </listitem>
292 </varlistentry>
293 <varlistentry>
294 <term><option>path</option></term>
295 <listitem>
296 <para>The name is set based on the device's physical
297 location, as exported by the udev property
298 <varname>ID_NET_NAME_PATH</varname>.</para>
299 </listitem>
300 </varlistentry>
301 <varlistentry>
302 <term><option>mac</option></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 <varname>ID_NET_NAME_MAC</varname>.</para>
307 </listitem>
308 </varlistentry>
309 <varlistentry>
310 <term><option>keep</option></term>
311 <listitem>
312 <para>If the device already had a name given by userspace (as part of creation of the device
313 or a rename), keep it.</para>
314 </listitem>
315 </varlistentry>
316 </variablelist>
317 </listitem>
318 </varlistentry>
319 <varlistentry>
320 <term><varname>Name=</varname></term>
321 <listitem>
322 <para>The interface name to use. This option has lower precedence than
323 <varname>NamePolicy=</varname>, so for this setting to take effect, <varname>NamePolicy=</varname>
324 must either be unset, empty, disabled, or all policies configured there must fail. Also see the
325 example below with <literal>Name=dmz0</literal>.</para>
326
327 <para>Note that specifying a name that the kernel might use for another
328 interface (for example <literal>eth0</literal>) is dangerous because the
329 name assignment done by udev will race with the assignment done by the
330 kernel, and only one interface may use the name. Depending on the order of
331 operations, either udev or the kernel will win, making the naming
332 unpredictable. It is best to use some different prefix, for example
333 <literal>internal0</literal>/<literal>external0</literal> or
334 <literal>lan0</literal>/<literal>lan1</literal>/<literal>lan3</literal>.
335 </para>
336 </listitem>
337 </varlistentry>
338 <varlistentry>
339 <term><varname>MTUBytes=</varname></term>
340 <listitem>
341 <para>The maximum transmission unit in bytes to set for the
342 device. The usual suffixes K, M, G, are supported and are
343 understood to the base of 1024.</para>
344 </listitem>
345 </varlistentry>
346 <varlistentry>
347 <term><varname>BitsPerSecond=</varname></term>
348 <listitem>
349 <para>The speed to set for the device, the value is rounded
350 down to the nearest Mbps. The usual suffixes K, M, G, are
351 supported and are understood to the base of 1000.</para>
352 </listitem>
353 </varlistentry>
354 <varlistentry>
355 <term><varname>Duplex=</varname></term>
356 <listitem>
357 <para>The duplex mode to set for the device. The accepted values are <option>half</option> and
358 <option>full</option>.</para>
359 </listitem>
360 </varlistentry>
361 <varlistentry>
362 <term><varname>AutoNegotiation=</varname></term>
363 <listitem>
364 <para>Takes a boolean. If set to yes, automatic negotiation of transmission parameters is enabled.
365 Autonegotiation is a procedure by which two connected ethernet devices choose
366 common transmission parameters, such as speed, duplex mode, and flow control.
367 When unset, the kernel's default will be used.</para>
368
369 <para>Note that if autonegotiation is enabled, speed and duplex settings are
370 read-only. If autonegotation is disabled, speed and duplex settings are writable
371 if the driver supports multiple link modes.</para>
372 </listitem>
373 </varlistentry>
374 <varlistentry>
375 <term><varname>WakeOnLan=</varname></term>
376 <listitem>
377 <para>The Wake-on-LAN policy to set for the device. The
378 supported values are:</para>
379
380 <variablelist>
381 <varlistentry>
382 <term><option>phy</option></term>
383 <listitem>
384 <para>Wake on PHY activity.</para>
385 </listitem>
386 </varlistentry>
387 <varlistentry>
388 <term><option>unicast</option></term>
389 <listitem>
390 <para>Wake on unicast messages.</para>
391 </listitem>
392 </varlistentry>
393 <varlistentry>
394 <term><option>multicast</option></term>
395 <listitem>
396 <para>Wake on multicast messages.</para>
397 </listitem>
398 </varlistentry>
399 <varlistentry>
400 <term><option>broadcast</option></term>
401 <listitem>
402 <para>Wake on broadcast messages.</para>
403 </listitem>
404 </varlistentry>
405 <varlistentry>
406 <term><option>arp</option></term>
407 <listitem>
408 <para>Wake on ARP.</para>
409 </listitem>
410 </varlistentry>
411 <varlistentry>
412 <term><option>magic</option></term>
413 <listitem>
414 <para>Wake on receipt of a magic packet.
415 </para>
416 </listitem>
417 </varlistentry>
418 <varlistentry>
419 <term><option>secureon</option></term>
420 <listitem>
421 <para>Enable secureon(tm) password for MagicPacket(tm).
422 </para>
423 </listitem>
424 </varlistentry>
425 <varlistentry>
426 <term><option>off</option></term>
427 <listitem>
428 <para>Never wake.</para>
429 </listitem>
430 </varlistentry>
431 </variablelist>
432
433 <para>Defaults to <option>off</option>.</para>
434 </listitem>
435 </varlistentry>
436 <varlistentry>
437 <term><varname>Port=</varname></term>
438 <listitem>
439 <para>The port option is used to select the device port. The
440 supported values are:</para>
441
442 <variablelist>
443 <varlistentry>
444 <term><option>tp</option></term>
445 <listitem>
446 <para>An Ethernet interface using Twisted-Pair cable as the medium.</para>
447 </listitem>
448 </varlistentry>
449 <varlistentry>
450 <term><option>aui</option></term>
451 <listitem>
452 <para>Attachment Unit Interface (AUI). Normally used with hubs.
453 </para>
454 </listitem>
455 </varlistentry>
456 <varlistentry>
457 <term><option>bnc</option></term>
458 <listitem>
459 <para>An Ethernet interface using BNC connectors and co-axial cable.</para>
460 </listitem>
461 </varlistentry>
462 <varlistentry>
463 <term><option>mii</option></term>
464 <listitem>
465 <para>An Ethernet interface using a Media Independent Interface (MII).</para>
466 </listitem>
467 </varlistentry>
468 <varlistentry>
469 <term><option>fibre</option></term>
470 <listitem>
471 <para>An Ethernet interface using Optical Fibre as the medium.</para>
472 </listitem>
473 </varlistentry>
474 </variablelist>
475 </listitem>
476 </varlistentry>
477 <varlistentry>
478 <term><varname>Advertise=</varname></term>
479 <listitem>
480 <para>This sets what speeds and duplex modes of operation are advertised for auto-negotiation.
481 This implies <literal>AutoNegotiation=yes</literal>. The supported values are:
482
483 <table>
484 <title>Supported advertise values</title>
485 <tgroup cols='3'>
486 <colspec colname='Advertise' />
487 <colspec colname='Speed' />
488 <colspec colname='Duplex Mode' />
489
490 <thead><row>
491 <entry>Advertise</entry>
492 <entry>Speed (Mbps)</entry>
493 <entry>Duplex Mode</entry>
494 </row></thead>
495 <tbody>
496 <row><entry><option>10baset-half</option></entry>
497 <entry>10</entry><entry>half</entry></row>
498
499 <row><entry><option>10baset-full</option></entry>
500 <entry>10</entry><entry>full</entry></row>
501
502 <row><entry><option>100baset-half</option></entry>
503 <entry>100</entry><entry>half</entry></row>
504
505 <row><entry><option>100baset-full</option></entry>
506 <entry>100</entry><entry>full</entry></row>
507
508 <row><entry><option>1000baset-half</option></entry>
509 <entry>1000</entry><entry>half</entry></row>
510
511 <row><entry><option>1000baset-full</option></entry>
512 <entry>1000</entry><entry>full</entry></row>
513
514 <row><entry><option>10000baset-full</option></entry>
515 <entry>10000</entry><entry>full</entry></row>
516
517 <row><entry><option>2500basex-full</option></entry>
518 <entry>2500</entry><entry>full</entry></row>
519
520 <row><entry><option>1000basekx-full</option></entry>
521 <entry>1000</entry><entry>full</entry></row>
522
523 <row><entry><option>10000basekx4-full</option></entry>
524 <entry>10000</entry><entry>full</entry></row>
525
526 <row><entry><option>10000basekr-full</option></entry>
527 <entry>10000</entry><entry>full</entry></row>
528
529 <row><entry><option>10000baser-fec</option></entry>
530 <entry>10000</entry><entry>full</entry></row>
531
532 <row><entry><option>20000basemld2-full</option></entry>
533 <entry>20000</entry><entry>full</entry></row>
534
535 <row><entry><option>20000basekr2-full</option></entry>
536 <entry>20000</entry><entry>full</entry></row>
537 </tbody>
538 </tgroup>
539 </table>
540
541 By default this is unset, i.e. all possible modes will be advertised.
542 This option may be specified more than once, in which case all specified speeds and modes are advertised.
543 If the empty string is assigned to this option, the list is reset, and all prior assignments have no effect.
544 </para>
545 </listitem>
546 </varlistentry>
547 <varlistentry>
548 <term><varname>TCPSegmentationOffload=</varname></term>
549 <listitem>
550 <para>Takes a boolean. If set to true, the TCP Segmentation Offload (TSO) is enabled.
551 When unset, the kernel's default will be used.</para>
552 </listitem>
553 </varlistentry>
554 <varlistentry>
555 <term><varname>TCP6SegmentationOffload=</varname></term>
556 <listitem>
557 <para>Takes a boolean. If set to true, the TCP6 Segmentation Offload (tx-tcp6-segmentation) is enabled.
558 When unset, the kernel's default will be used.</para>
559 </listitem>
560 </varlistentry>
561 <varlistentry>
562 <term><varname>GenericSegmentationOffload=</varname></term>
563 <listitem>
564 <para>Takes a boolean. If set to true, the Generic Segmentation Offload (GSO) is enabled.
565 When unset, the kernel's default will be used.</para>
566 </listitem>
567 </varlistentry>
568 <varlistentry>
569 <term><varname>GenericReceiveOffload=</varname></term>
570 <listitem>
571 <para>Takes a boolean. If set to true, the Generic Receive Offload (GRO) is enabled.
572 When unset, the kernel's default will be used.</para>
573 </listitem>
574 </varlistentry>
575 <varlistentry>
576 <term><varname>LargeReceiveOffload=</varname></term>
577 <listitem>
578 <para>Takes a boolean. If set to true, the Large Receive Offload (LRO) is enabled.
579 When unset, the kernel's default will be used.</para>
580 </listitem>
581 </varlistentry>
582 <varlistentry>
583 <term><varname>RxChannels=</varname></term>
584 <listitem>
585 <para>Sets the number of receive channels (a number between 1 and 4294967295) .</para>
586 </listitem>
587 </varlistentry>
588 <varlistentry>
589 <term><varname>TxChannels=</varname></term>
590 <listitem>
591 <para>Sets the number of transmit channels (a number between 1 and 4294967295).</para>
592 </listitem>
593 </varlistentry>
594 <varlistentry>
595 <term><varname>OtherChannels=</varname></term>
596 <listitem>
597 <para>Sets the number of other channels (a number between 1 and 4294967295).</para>
598 </listitem>
599 </varlistentry>
600 <varlistentry>
601 <term><varname>CombinedChannels=</varname></term>
602 <listitem>
603 <para>Sets the number of combined set channels (a number between 1 and 4294967295).</para>
604 </listitem>
605 </varlistentry>
606 </variablelist>
607 </refsect1>
608
609 <refsect1>
610 <title>Examples</title>
611
612 <example>
613 <title>/usr/lib/systemd/network/99-default.link</title>
614
615 <para>The link file <filename>99-default.link</filename> that is
616 shipped with systemd defines the default naming policy for
617 links.</para>
618
619 <programlisting>[Link]
620 NamePolicy=kernel database onboard slot path
621 MACAddressPolicy=persistent</programlisting>
622 </example>
623
624 <example>
625 <title>/etc/systemd/network/10-dmz.link</title>
626
627 <para>This example assigns the fixed name <literal>dmz0</literal> to the interface with the MAC address
628 00:a0:de:63:7a:e6:</para>
629
630 <programlisting>[Match]
631 MACAddress=00:a0:de:63:7a:e6
632
633 [Link]
634 Name=dmz0</programlisting>
635
636 <para><varname>NamePolicy=</varname> is not set, so <varname>Name=</varname> takes effect. We use the
637 <literal>10-</literal> prefix to order this file early in the list. Note that it needs to before
638 <literal>99-link</literal>, i.e. it needs a numerical prefix, to have any effect at all.</para>
639 </example>
640
641 <example>
642 <title>Debugging <varname>NamePolicy=</varname> assignments</title>
643
644 <programlisting>$ sudo SYSTEMD_LOG_LEVEL=debug udevadm test-builtin net_setup_link /sys/class/net/hub0
645
646 Parsed configuration file /usr/lib/systemd/network/99-default.link
647 Parsed configuration file /etc/systemd/network/10-eth0.link
648 ID_NET_DRIVER=cdc_ether
649 Config file /etc/systemd/network/10-eth0.link applies to device hub0
650 link_config: autonegotiation is unset or enabled, the speed and duplex are not writable.
651 hub0: Device has name_assign_type=4
652 Using default interface naming scheme 'v240'.
653 hub0: Policies didn't yield a name, using specified Name=hub0.
654 ID_NET_LINK_FILE=/etc/systemd/network/10-eth0.link
655 ID_NET_NAME=hub0
656</programlisting>
657
658 <para>Explicit <varname>Name=</varname> configuration wins in this case.</para>
659
660 <programlisting>sudo SYSTEMD_LOG_LEVEL=debug udevadm test-builtin net_setup_link /sys/class/net/enp0s31f6
661
662 Parsed configuration file /usr/lib/systemd/network/99-default.link
663 Parsed configuration file /etc/systemd/network/10-eth0.link
664 Created link configuration context.
665 ID_NET_DRIVER=e1000e
666 Config file /usr/lib/systemd/network/99-default.link applies to device enp0s31f6
667 link_config: autonegotiation is unset or enabled, the speed and duplex are not writable.
668 enp0s31f6: Device has name_assign_type=4
669 Using default interface naming scheme 'v240'.
670 enp0s31f6: Policy *keep*: keeping existing userspace name
671 enp0s31f6: Device has addr_assign_type=0
672 enp0s31f6: MAC on the device already matches policy *persistent*
673 ID_NET_LINK_FILE=/usr/lib/systemd/network/99-default.link
674
675 </programlisting>
676
677 <para>In this case, the interface was already renamed, so the <option>keep</option> policy specified as
678 the first option in <filename noindex='true'>99-default.link</filename> means that the existing name is
679 preserved. If <option>keep</option> was removed, or if were in boot before the renaming has happened,
680 we might get the following instead:</para>
681
682 <programlisting>enp0s31f6: Policy *path* yields "enp0s31f6".
683 enp0s31f6: Device has addr_assign_type=0
684 enp0s31f6: MAC on the device already matches policy *persistent*
685 ID_NET_LINK_FILE=/usr/lib/systemd/network/99-default.link
686 ID_NET_NAME=enp0s31f6
687
688 </programlisting>
689
690 <para>Please note that the details of output are subject to change.</para>
691 </example>
692
693 <example>
694 <title>/etc/systemd/network/10-internet.link</title>
695
696 <para>This example assigns the fixed name
697 <literal>internet0</literal> to the interface with the device
698 path <literal>pci-0000:00:1a.0-*</literal>:</para>
699
700 <programlisting>[Match]
701 Path=pci-0000:00:1a.0-*
702
703 [Link]
704 Name=internet0</programlisting>
705 </example>
706
707 <example>
708 <title>/etc/systemd/network/25-wireless.link</title>
709
710 <para>Here's an overly complex example that shows the use of a large number of [Match] and [Link] settings.</para>
711
712 <programlisting>[Match]
713 MACAddress=12:34:56:78:9a:bc
714 Driver=brcmsmac
715 Path=pci-0000:02:00.0-*
716 Type=wlan
717 Virtualization=no
718 Host=my-laptop
719 Architecture=x86-64
720
721 [Link]
722 Name=wireless0
723 MTUBytes=1450
724 BitsPerSecond=10M
725 WakeOnLan=magic
726 MACAddress=cb:a9:87:65:43:21</programlisting>
727 </example>
728 </refsect1>
729
730 <refsect1>
731 <title>See Also</title>
732 <para>
733 <citerefentry>
734 <refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum>
735 </citerefentry>,
736 <citerefentry>
737 <refentrytitle>udevadm</refentrytitle><manvolnum>8</manvolnum>
738 </citerefentry>,
739 <citerefentry>
740 <refentrytitle>systemd.netdev</refentrytitle><manvolnum>5</manvolnum>
741 </citerefentry>,
742 <citerefentry>
743 <refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum>
744 </citerefentry>
745 </para>
746 </refsect1>
747
748 </refentry>