]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd.link.xml
man: sync the default .link file in example
[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-or-later -->
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>A plain ini-style text file that encodes configuration for matching network devices, used by
30 <citerefentry><refentrytitle>systemd-udevd</refentrytitle><manvolnum>8</manvolnum></citerefentry> and in
31 particular its <command>net_setup_link</command> builtin. See
32 <citerefentry><refentrytitle>systemd.syntax</refentrytitle><manvolnum>7</manvolnum></citerefentry> for a
33 general description of the syntax.</para>
34
35 <para>The <filename>.link</filename> files are read from the files located in the system network
36 directory <filename>/usr/lib/systemd/network</filename> and
37 <filename>/usr/local/lib/systemd/network</filename>, the volatile runtime network directory
38 <filename>/run/systemd/network</filename>, and the local administration network directory
39 <filename>/etc/systemd/network</filename>. All configuration files are collectively sorted and
40 processed in alphanumeric order, regardless of the directories in which they live. However, files
41 with identical filenames replace each other. It is recommended that each filename is prefixed with
42 a number (e.g. <filename>10-eth0.link</filename>). Otherwise, the default
43 <filename>.link</filename> files or those generated by
44 <citerefentry><refentrytitle>systemd-network-generator.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
45 may take precedence over user configured files. Files in <filename>/etc/</filename> have the
46 highest priority, files in <filename>/run/</filename> take precedence over files with the same name
47 in <filename>/usr/lib/</filename>. This can be used to override a system-supplied link file with a
48 local file if needed. As a special case, an empty file (file size 0) or symlink with the same name
49 pointing to <filename>/dev/null</filename> disables the configuration file entirely (it is
50 "masked").</para>
51
52 <para>Along with the link file <filename>foo.link</filename>, a "drop-in" directory
53 <filename>foo.link.d/</filename> may exist. All files with the suffix <literal>.conf</literal>
54 from this directory will be merged in the alphanumeric order and parsed after the main file itself
55 has been parsed. This is useful to alter or add configuration settings, without having to modify
56 the main configuration file. Each drop-in file must have appropriate section headers.</para>
57
58 <para>In addition to <filename>/etc/systemd/network</filename>, drop-in <literal>.d</literal>
59 directories can be placed in <filename>/usr/lib/systemd/network</filename> or
60 <filename>/run/systemd/network</filename> directories. Drop-in files in <filename>/etc/</filename>
61 take precedence over those in <filename>/run/</filename> which in turn take precedence over those
62 in <filename>/usr/lib/</filename>. Drop-in files under any of these directories take precedence
63 over the main link file wherever located.</para>
64
65 <para>The link file contains a [Match] section, which determines if a given link file may be applied to a
66 given device, as well as a [Link] section specifying how the device should be configured. The first (in
67 lexical order) of the link files that matches a given device is applied. Note that a default file
68 <filename>99-default.link</filename> is shipped by the system. Any user-supplied
69 <filename>.link</filename> should hence have a lexically earlier name to be considered at all.</para>
70
71 <para>See <citerefentry><refentrytitle>udevadm</refentrytitle><manvolnum>8</manvolnum></citerefentry> for
72 diagnosing problems with <filename>.link</filename> files.</para>
73 </refsect1>
74
75 <refsect1>
76 <title>[Match] Section Options</title>
77
78 <para>A link file is said to match an interface if all matches specified by the [Match] section are
79 satisfied. When a link file does not contain valid settings in [Match] section, then the file will
80 match all interfaces and <command>systemd-udevd</command> warns about that. Hint: to avoid the
81 warning and to make it clear that all interfaces shall be matched, add the following:
82 <programlisting>OriginalName=*</programlisting>
83 The first (in alphanumeric order) of the link files that matches a given interface is applied, all
84 later files are ignored, even if they match as well. The following keys are accepted:</para>
85
86 <variablelist class='network-directives'>
87 <!-- This list is reused in systemd.network(3), hence maintain a specific order:
88 1. device matches shared between the two lists
89 2. non-shared settings
90 3. host matches shared between the two lists
91 -->
92
93 <varlistentry id='mac-address'>
94 <term><varname>MACAddress=</varname></term>
95 <listitem>
96 <para>A whitespace-separated list of hardware addresses. The acceptable formats are:</para>
97
98 <variablelist>
99 <varlistentry>
100 <term><option>colon-delimited hexadecimal</option></term>
101 <listitem><para>
102 Each field must be one byte.
103 E.g. <literal>12:34:56:78:90:ab</literal> or <literal>AA:BB:CC:DD:EE:FF</literal>.
104 </para></listitem>
105 </varlistentry>
106 <varlistentry>
107 <term><option>hyphen-delimited hexadecimal</option></term>
108 <listitem><para>
109 Each field must be one byte.
110 E.g. <literal>12-34-56-78-90-ab</literal> or <literal>AA-BB-CC-DD-EE-FF</literal>.
111 </para></listitem>
112 </varlistentry>
113 <varlistentry>
114 <term><option>dot-delimited hexadecimal</option></term>
115 <listitem><para>
116 Each field must be two bytes.
117 E.g. <literal>1234.5678.90ab</literal> or <literal>AABB.CCDD.EEFF</literal>.
118 </para></listitem>
119 </varlistentry>
120 <varlistentry>
121 <term><option>IPv4 address format</option></term>
122 <listitem><para>
123 E.g. <literal>127.0.0.1</literal> or <literal>192.168.0.1</literal>.
124 </para></listitem>
125 </varlistentry>
126 <varlistentry>
127 <term><option>IPv6 address format</option></term>
128 <listitem><para>
129 E.g. <literal>2001:0db8:85a3::8a2e:0370:7334</literal> or <literal>::1</literal>.
130 </para></listitem>
131 </varlistentry>
132 </variablelist>
133
134 <para>The total length of each MAC address must be 4 (for IPv4 tunnel), 6 (for Ethernet), 16
135 (for IPv6 tunnel), or 20 (for InfiniBand). This option may appear more than once, in which
136 case the lists are merged. If the empty string is assigned to this option, the list of
137 hardware addresses defined prior to this is reset. Defaults to unset.</para>
138 </listitem>
139 </varlistentry>
140
141 <varlistentry id='permanent-mac-address'>
142 <term><varname>PermanentMACAddress=</varname></term>
143 <listitem>
144 <para>A whitespace-separated list of hardware's permanent addresses. While
145 <varname>MACAddress=</varname> matches the device's current MAC address, this matches the
146 device's permanent MAC address, which may be different from the current one. Use full
147 colon-, hyphen- or dot-delimited hexadecimal, or IPv4 or IPv6 address format. This option may
148 appear more than once, in which case the lists are merged. If the empty string is assigned to
149 this option, the list of hardware addresses defined prior to this is reset. Defaults to
150 unset.</para>
151 </listitem>
152 </varlistentry>
153
154 <varlistentry id='path'>
155 <term><varname>Path=</varname></term>
156 <listitem>
157 <para>A whitespace-separated list of shell-style globs matching
158 the persistent path, as exposed by the udev property
159 <varname>ID_PATH</varname>.</para>
160 </listitem>
161 </varlistentry>
162
163 <varlistentry id='driver'>
164 <term><varname>Driver=</varname></term>
165 <listitem>
166 <para>A whitespace-separated list of shell-style globs matching the driver currently bound to the
167 device, as exposed by the udev property <varname>ID_NET_DRIVER</varname> of its parent device, or
168 if that is not set, the driver as exposed by <command>ethtool -i</command> of the device itself.
169 If the list is prefixed with a "!", the test is inverted.</para>
170 </listitem>
171 </varlistentry>
172
173 <varlistentry id='type'>
174 <term><varname>Type=</varname></term>
175 <listitem>
176 <para>A whitespace-separated list of shell-style globs matching the device type, as exposed by
177 <command>networkctl list</command>. If the list is prefixed with a "!", the test is inverted.
178 Some valid values are <literal>ether</literal>, <literal>loopback</literal>, <literal>wlan</literal>, <literal>wwan</literal>.
179 Valid types are named either from the udev <literal>DEVTYPE</literal> attribute, or
180 <literal>ARPHRD_</literal> macros in <filename>linux/if_arp.h</filename>, so this is not comprehensive.
181 </para>
182 </listitem>
183 </varlistentry>
184
185 <varlistentry id='kind'>
186 <term><varname>Kind=</varname></term>
187 <listitem>
188 <para>A whitespace-separated list of shell-style globs matching the device kind, as exposed by
189 <command>networkctl status <replaceable>INTERFACE</replaceable></command> or
190 <command>ip -d link show <replaceable>INTERFACE</replaceable></command>. If the list is
191 prefixed with a "!", the test is inverted. Some valid values are <literal>bond</literal>,
192 <literal>bridge</literal>, <literal>gre</literal>, <literal>tun</literal>,
193 <literal>veth</literal>. Valid kinds are given by netlink's <literal>IFLA_INFO_KIND</literal>
194 attribute, so this is not comprehensive.
195 </para>
196 </listitem>
197 </varlistentry>
198
199 <varlistentry id='property'>
200 <term><varname>Property=</varname></term>
201 <listitem>
202 <para>A whitespace-separated list of udev property names with their values after equals sign
203 (<literal>=</literal>). If multiple properties are specified, the test results are ANDed.
204 If the list is prefixed with a "!", the test is inverted. If a value contains white
205 spaces, then please quote whole key and value pair. If a value contains quotation, then
206 please escape the quotation with <literal>\</literal>.</para>
207
208 <para>Example: if a .link file has the following:
209 <programlisting>Property=ID_MODEL_ID=9999 "ID_VENDOR_FROM_DATABASE=vendor name" "KEY=with \"quotation\""</programlisting>
210 then, the .link file matches only when an interface has all the above three properties.
211 </para>
212 </listitem>
213 </varlistentry>
214
215 <varlistentry>
216 <term><varname>OriginalName=</varname></term>
217 <listitem>
218 <para>A whitespace-separated list of shell-style globs matching the device name, as exposed by the
219 udev property "INTERFACE". This cannot be used to match on names that have already been changed
220 from userspace. Caution is advised when matching on kernel-assigned names, as they are known to be
221 unstable between reboots.</para>
222 </listitem>
223 </varlistentry>
224
225 <varlistentry id='host'>
226 <term><varname>Host=</varname></term>
227 <listitem>
228 <para>Matches against the hostname or machine ID of the host. See <varname>ConditionHost=</varname> in
229 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
230 for details. When prefixed with an exclamation mark (<literal>!</literal>), the result is negated.
231 If an empty string is assigned, the previously assigned value is cleared.
232 </para>
233 </listitem>
234 </varlistentry>
235
236 <varlistentry id='virtualization'>
237 <term><varname>Virtualization=</varname></term>
238 <listitem>
239 <para>Checks whether the system is executed in a virtualized environment and optionally test
240 whether it is a specific implementation. See <varname>ConditionVirtualization=</varname> in
241 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
242 for details. When prefixed with an exclamation mark (<literal>!</literal>), the result is negated.
243 If an empty string is assigned, the previously assigned value is cleared.
244 </para>
245 </listitem>
246 </varlistentry>
247
248 <varlistentry id='kernel-command-line'>
249 <term><varname>KernelCommandLine=</varname></term>
250 <listitem>
251 <para>Checks whether a specific kernel command line option is set. See
252 <varname>ConditionKernelCommandLine=</varname> in
253 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
254 for details. When prefixed with an exclamation mark (<literal>!</literal>), the result is negated.
255 If an empty string is assigned, the previously assigned value is cleared.
256 </para>
257 </listitem>
258 </varlistentry>
259
260 <varlistentry id='kernel-version'>
261 <term><varname>KernelVersion=</varname></term>
262 <listitem>
263 <para>Checks whether the kernel version (as reported by <command>uname -r</command>) matches a certain
264 expression. See <varname>ConditionKernelVersion=</varname> in
265 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry> for
266 details. When prefixed with an exclamation mark (<literal>!</literal>), the result is negated.
267 If an empty string is assigned, the previously assigned value is cleared.
268 </para>
269 </listitem>
270 </varlistentry>
271
272 <varlistentry id='credential'>
273 <term><varname>Credential=</varname></term>
274 <listitem>
275 <para>Checks whether the specified credential was passed to the
276 <filename>systemd-udevd.service</filename> service. See <ulink
277 url="https://systemd.io/CREDENTIALS">System and Service Credentials</ulink> for details. When
278 prefixed with an exclamation mark (<literal>!</literal>), the result is negated. If an empty
279 string is assigned, the previously assigned value is cleared.
280 </para>
281 </listitem>
282 </varlistentry>
283
284 <varlistentry id='architecture'>
285 <term><varname>Architecture=</varname></term>
286 <listitem>
287 <para>Checks whether the system is running on a specific architecture. See
288 <varname>ConditionArchitecture=</varname> in
289 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
290 for details. When prefixed with an exclamation mark (<literal>!</literal>), the result is negated.
291 If an empty string is assigned, the previously assigned value is cleared.
292 </para>
293 </listitem>
294 </varlistentry>
295
296 <varlistentry id='firmware'>
297 <term><varname>Firmware=</varname></term>
298 <listitem>
299 <para>Checks whether the system is running on a machine with the specified firmware. See
300 <varname>ConditionFirmware=</varname> in
301 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
302 for details. When prefixed with an exclamation mark (<literal>!</literal>), the result is negated.
303 If an empty string is assigned, the previously assigned value is cleared.
304 </para>
305 </listitem>
306 </varlistentry>
307 </variablelist>
308
309 </refsect1>
310
311 <refsect1>
312 <title>[Link] Section Options</title>
313
314 <para>The [Link] section accepts the following
315 keys:</para>
316
317 <variablelist class='network-directives'>
318 <varlistentry>
319 <term><varname>Description=</varname></term>
320 <listitem>
321 <para>A description of the device.</para>
322 </listitem>
323 </varlistentry>
324 <varlistentry>
325 <term><varname>Alias=</varname></term>
326 <listitem>
327 <para>The <varname>ifalias</varname> interface property is set to this value.</para>
328 </listitem>
329 </varlistentry>
330 <varlistentry>
331 <term><varname>MACAddressPolicy=</varname></term>
332 <listitem>
333 <para>The policy by which the MAC address should be set. The
334 available policies are:
335 </para>
336
337 <variablelist>
338 <varlistentry>
339 <term><option>persistent</option></term>
340 <listitem>
341 <para>If the hardware has a persistent MAC address, as
342 most hardware should, and if it is used by the kernel,
343 nothing is done. Otherwise, a new MAC address is
344 generated which is guaranteed to be the same on every
345 boot for the given machine and the given device, but
346 which is otherwise random. This feature depends on ID_NET_NAME_*
347 properties to exist for the link. On hardware where these
348 properties are not set, the generation of a persistent MAC address
349 will fail.</para>
350 </listitem>
351 </varlistentry>
352 <varlistentry>
353 <term><option>random</option></term>
354 <listitem>
355 <para>If the kernel is using a random MAC address,
356 nothing is done. Otherwise, a new address is randomly
357 generated each time the device appears, typically at
358 boot. Either way, the random address will have the
359 <literal>unicast</literal> and
360 <literal>locally administered</literal> bits set.</para>
361 </listitem>
362 </varlistentry>
363 <varlistentry>
364 <term><option>none</option></term>
365 <listitem>
366 <para>Keeps the MAC address assigned by the kernel. Or use the MAC address specified in
367 <varname>MACAddress=</varname>.</para>
368 </listitem>
369 </varlistentry>
370 </variablelist>
371
372 <para>An empty string assignment is equivalent to setting <literal>none</literal>.</para>
373 </listitem>
374 </varlistentry>
375 <varlistentry>
376 <term><varname>MACAddress=</varname></term>
377 <listitem>
378 <para>The interface MAC address to use. For this setting to take effect,
379 <varname>MACAddressPolicy=</varname> must either be unset, empty, or <literal>none</literal>.
380 </para>
381 </listitem>
382 </varlistentry>
383 <varlistentry>
384 <term><varname>NamePolicy=</varname></term>
385 <listitem>
386 <para>An ordered, space-separated list of policies by which the interface name should be set.
387 <varname>NamePolicy=</varname> may be disabled by specifying <option>net.ifnames=0</option> on the
388 kernel command line. Each of the policies may fail, and the first successful one is used. The name
389 is not set directly, but is exported to udev as the property <option>ID_NET_NAME</option>, which
390 is, by default, used by a
391 <citerefentry><refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
392 rule to set <varname>NAME</varname>. The available policies are:
393 </para>
394
395 <variablelist>
396 <varlistentry>
397 <term><option>kernel</option></term>
398 <listitem>
399 <para>If the kernel claims that the name it has set
400 for a device is predictable, then no renaming is
401 performed.</para>
402 </listitem>
403 </varlistentry>
404 <varlistentry>
405 <term><option>database</option></term>
406 <listitem>
407 <para>The name is set based on entries in the udev's
408 Hardware Database with the key
409 <varname>ID_NET_NAME_FROM_DATABASE</varname>.
410 </para>
411 </listitem>
412 </varlistentry>
413 <varlistentry>
414 <term><option>onboard</option></term>
415 <listitem>
416 <para>The name is set based on information given by
417 the firmware for on-board devices, as exported by the
418 udev property <varname>ID_NET_NAME_ONBOARD</varname>.
419 See <citerefentry><refentrytitle>systemd.net-naming-scheme</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
420 </para>
421 </listitem>
422 </varlistentry>
423 <varlistentry>
424 <term><option>slot</option></term>
425 <listitem>
426 <para>The name is set based on information given by
427 the firmware for hot-plug devices, as exported by the
428 udev property <varname>ID_NET_NAME_SLOT</varname>.
429 See <citerefentry><refentrytitle>systemd.net-naming-scheme</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
430 </para>
431 </listitem>
432 </varlistentry>
433 <varlistentry>
434 <term><option>path</option></term>
435 <listitem>
436 <para>The name is set based on the device's physical
437 location, as exported by the udev property
438 <varname>ID_NET_NAME_PATH</varname>.
439 See <citerefentry><refentrytitle>systemd.net-naming-scheme</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
440 </para>
441 </listitem>
442 </varlistentry>
443 <varlistentry>
444 <term><option>mac</option></term>
445 <listitem>
446 <para>The name is set based on the device's persistent
447 MAC address, as exported by the udev property
448 <varname>ID_NET_NAME_MAC</varname>.
449 See <citerefentry><refentrytitle>systemd.net-naming-scheme</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
450 </para>
451 </listitem>
452 </varlistentry>
453 <varlistentry>
454 <term><option>keep</option></term>
455 <listitem>
456 <para>If the device already had a name given by userspace (as part of creation of the device
457 or a rename), keep it.</para>
458 </listitem>
459 </varlistentry>
460 </variablelist>
461 </listitem>
462 </varlistentry>
463 <varlistentry>
464 <term><varname>Name=</varname></term>
465 <listitem>
466 <para>The interface name to use. This option has lower precedence than
467 <varname>NamePolicy=</varname>, so for this setting to take effect, <varname>NamePolicy=</varname>
468 must either be unset, empty, disabled, or all policies configured there must fail. Also see the
469 example below with <literal>Name=dmz0</literal>.</para>
470
471 <para>Note that specifying a name that the kernel might use for another interface (for example
472 <literal>eth0</literal>) is dangerous because the name assignment done by udev will race with the
473 assignment done by the kernel, and only one interface may use the name. Depending on the order of
474 operations, either udev or the kernel will win, making the naming unpredictable. It is best to use
475 some different prefix, for example <literal>internal0</literal>/<literal>external0</literal> or
476 <literal>lan0</literal>/<literal>lan1</literal>/<literal>lan3</literal>.</para>
477
478 <para>Interface names must have a minimum length of 1 character and a maximum length of 15
479 characters, and may contain any 7bit ASCII character, with the exception of control characters,
480 <literal>:</literal>, <literal>/</literal> and <literal>%</literal>. While <literal>.</literal> is
481 an allowed character, it's recommended to avoid it when naming interfaces as various tools (such as
482 <citerefentry><refentrytitle>resolvconf</refentrytitle><manvolnum>1</manvolnum></citerefentry>) use
483 it as separator character. Also, fully numeric interface names are not allowed (in order to avoid
484 ambiguity with interface specification by numeric indexes), as are the special strings
485 <literal>.</literal>, <literal>..</literal>, <literal>all</literal> and
486 <literal>default</literal>.</para>
487 </listitem>
488 </varlistentry>
489 <varlistentry>
490 <term><varname>AlternativeNamesPolicy=</varname></term>
491 <listitem>
492 <para>A space-separated list of policies by which the interface's alternative names
493 should be set. Each of the policies may fail, and all successful policies are used. The
494 available policies are <literal>database</literal>, <literal>onboard</literal>,
495 <literal>slot</literal>, <literal>path</literal>, and <literal>mac</literal>. If the
496 kernel does not support the alternative names, then this setting will be ignored.
497 </para>
498 </listitem>
499 </varlistentry>
500 <varlistentry>
501 <term><varname>AlternativeName=</varname></term>
502 <listitem>
503 <para>The alternative interface name to use. This option can be specified multiple times.
504 If the empty string is assigned to this option, the list is reset, and all prior assignments
505 have no effect. If the kernel does not support the alternative names, then this setting will
506 be ignored.</para>
507
508 <para>Alternative interface names may be used to identify interfaces in various tools. In contrast
509 to the primary name (as configured with <varname>Name=</varname> above) there may be multiple
510 alternative names referring to the same interface. Alternative names may have a maximum length of
511 127 characters, in contrast to the 15 allowed for the primary interface name, but otherwise are
512 subject to the same naming constraints.</para>
513 </listitem>
514 </varlistentry>
515 <varlistentry>
516 <term><varname>TransmitQueues=</varname></term>
517 <listitem>
518 <para>Specifies the device's number of transmit queues. An integer in the range 14096.
519 When unset, the kernel's default will be used.</para>
520 </listitem>
521 </varlistentry>
522 <varlistentry>
523 <term><varname>ReceiveQueues=</varname></term>
524 <listitem>
525 <para>Specifies the device's number of receive queues. An integer in the range 14096.
526 When unset, the kernel's default will be used.</para>
527 </listitem>
528 </varlistentry>
529 <varlistentry>
530 <term><varname>TransmitQueueLength=</varname></term>
531 <listitem>
532 <para>Specifies the transmit queue length of the device in number of packets. An unsigned integer
533 in the range 04294967294. When unset, the kernel's default will be used.</para>
534 </listitem>
535 </varlistentry>
536 <varlistentry>
537 <term><varname>MTUBytes=</varname></term>
538 <listitem>
539 <para>The maximum transmission unit in bytes to set for the
540 device. The usual suffixes K, M, G are supported and are
541 understood to the base of 1024.</para>
542 </listitem>
543 </varlistentry>
544 <varlistentry>
545 <term><varname>BitsPerSecond=</varname></term>
546 <listitem>
547 <para>The speed to set for the device, the value is rounded
548 down to the nearest Mbps. The usual suffixes K, M, G are
549 supported and are understood to the base of 1000.</para>
550 </listitem>
551 </varlistentry>
552 <varlistentry>
553 <term><varname>Duplex=</varname></term>
554 <listitem>
555 <para>The duplex mode to set for the device. The accepted values are <option>half</option> and
556 <option>full</option>.</para>
557 </listitem>
558 </varlistentry>
559 <varlistentry>
560 <term><varname>AutoNegotiation=</varname></term>
561 <listitem>
562 <para>Takes a boolean. If set to yes, automatic negotiation of transmission parameters is enabled.
563 Autonegotiation is a procedure by which two connected ethernet devices choose
564 common transmission parameters, such as speed, duplex mode, and flow control.
565 When unset, the kernel's default will be used.</para>
566
567 <para>Note that if autonegotiation is enabled, speed and duplex settings are
568 read-only. If autonegotiation is disabled, speed and duplex settings are writable
569 if the driver supports multiple link modes.</para>
570 </listitem>
571 </varlistentry>
572 <varlistentry>
573 <term><varname>WakeOnLan=</varname></term>
574 <listitem>
575 <para>The Wake-on-LAN policy to set for the device. Takes the special value
576 <literal>off</literal> which disables Wake-on-LAN, or space separated list of the following
577 words:</para>
578
579 <variablelist>
580 <varlistentry>
581 <term><option>phy</option></term>
582 <listitem>
583 <para>Wake on PHY activity.</para>
584 </listitem>
585 </varlistentry>
586 <varlistentry>
587 <term><option>unicast</option></term>
588 <listitem>
589 <para>Wake on unicast messages.</para>
590 </listitem>
591 </varlistentry>
592 <varlistentry>
593 <term><option>multicast</option></term>
594 <listitem>
595 <para>Wake on multicast messages.</para>
596 </listitem>
597 </varlistentry>
598 <varlistentry>
599 <term><option>broadcast</option></term>
600 <listitem>
601 <para>Wake on broadcast messages.</para>
602 </listitem>
603 </varlistentry>
604 <varlistentry>
605 <term><option>arp</option></term>
606 <listitem>
607 <para>Wake on ARP.</para>
608 </listitem>
609 </varlistentry>
610 <varlistentry>
611 <term><option>magic</option></term>
612 <listitem>
613 <para>Wake on receipt of a magic packet.
614 </para>
615 </listitem>
616 </varlistentry>
617 <varlistentry>
618 <term><option>secureon</option></term>
619 <listitem>
620 <para>Enable SecureOn password for MagicPacket. Implied when
621 <varname>WakeOnLanPassword=</varname> is specified. If specified without
622 <varname>WakeOnLanPassword=</varname> option, then the password is read from the
623 credential <literal><replaceable>LINK</replaceable>.link.wol.password</literal> (e.g.,
624 <literal>60-foo.link.wol.password</literal>), and if the credential not found, then
625 read from <literal>wol.password</literal>. See
626 <varname>LoadCredential=</varname>/<varname>SetCredential=</varname> in
627 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>1</manvolnum></citerefentry>
628 for details. The password in the credential, must be 6 bytes in hex format with each
629 byte separated by a colon (<literal>:</literal>) like an Ethernet MAC address, e.g.,
630 <literal>aa:bb:cc:dd:ee:ff</literal>.</para>
631 </listitem>
632 </varlistentry>
633 </variablelist>
634
635 <para>Defaults to unset, and the device's default will be used. This setting can be specified
636 multiple times. If an empty string is assigned, then the all previous assignments are
637 cleared.</para>
638 </listitem>
639 </varlistentry>
640 <varlistentry>
641 <term><varname>WakeOnLanPassword=</varname></term>
642 <listitem>
643 <para>Specifies the SecureOn password for MagicPacket. Takes an absolute path to a regular
644 file or an <constant>AF_UNIX</constant> stream socket, or the plain password. When a path to
645 a regular file is specified, the password is read from it. When an
646 <constant>AF_UNIX</constant> stream socket is specified, a connection is made to it and the
647 password is read from it. The password must be 6 bytes in hex format with each byte separated
648 by a colon (<literal>:</literal>) like an Ethernet MAC address, e.g.,
649 <literal>aa:bb:cc:dd:ee:ff</literal>. This implies <varname>WakeOnLan=secureon</varname>.
650 Defaults to unset, and the current value will not be changed.</para>
651 </listitem>
652 </varlistentry>
653 <varlistentry>
654 <term><varname>Port=</varname></term>
655 <listitem>
656 <para>The port option is used to select the device port. The
657 supported values are:</para>
658
659 <variablelist>
660 <varlistentry>
661 <term><option>tp</option></term>
662 <listitem>
663 <para>An Ethernet interface using Twisted-Pair cable as the medium.</para>
664 </listitem>
665 </varlistentry>
666 <varlistentry>
667 <term><option>aui</option></term>
668 <listitem>
669 <para>Attachment Unit Interface (AUI). Normally used with hubs.
670 </para>
671 </listitem>
672 </varlistentry>
673 <varlistentry>
674 <term><option>bnc</option></term>
675 <listitem>
676 <para>An Ethernet interface using BNC connectors and co-axial cable.</para>
677 </listitem>
678 </varlistentry>
679 <varlistentry>
680 <term><option>mii</option></term>
681 <listitem>
682 <para>An Ethernet interface using a Media Independent Interface (MII).</para>
683 </listitem>
684 </varlistentry>
685 <varlistentry>
686 <term><option>fibre</option></term>
687 <listitem>
688 <para>An Ethernet interface using Optical Fibre as the medium.</para>
689 </listitem>
690 </varlistentry>
691 </variablelist>
692 </listitem>
693 </varlistentry>
694 <varlistentry>
695 <term><varname>Advertise=</varname></term>
696 <listitem>
697 <para>This sets what speeds and duplex modes of operation are advertised for auto-negotiation.
698 This implies <literal>AutoNegotiation=yes</literal>. The supported values are:
699
700 <table>
701 <title>Supported advertise values</title>
702 <tgroup cols='3'>
703 <colspec colname='Advertise' />
704 <colspec colname='Speed' />
705 <colspec colname='Duplex Mode' />
706
707 <thead><row>
708 <entry>Advertise</entry>
709 <entry>Speed (Mbps)</entry>
710 <entry>Duplex Mode</entry>
711 </row></thead>
712 <tbody>
713 <row><entry><option>10baset-half</option></entry>
714 <entry>10</entry><entry>half</entry></row>
715
716 <row><entry><option>10baset-full</option></entry>
717 <entry>10</entry><entry>full</entry></row>
718
719 <row><entry><option>100baset-half</option></entry>
720 <entry>100</entry><entry>half</entry></row>
721
722 <row><entry><option>100baset-full</option></entry>
723 <entry>100</entry><entry>full</entry></row>
724
725 <row><entry><option>1000baset-half</option></entry>
726 <entry>1000</entry><entry>half</entry></row>
727
728 <row><entry><option>1000baset-full</option></entry>
729 <entry>1000</entry><entry>full</entry></row>
730
731 <row><entry><option>10000baset-full</option></entry>
732 <entry>10000</entry><entry>full</entry></row>
733
734 <row><entry><option>2500basex-full</option></entry>
735 <entry>2500</entry><entry>full</entry></row>
736
737 <row><entry><option>1000basekx-full</option></entry>
738 <entry>1000</entry><entry>full</entry></row>
739
740 <row><entry><option>10000basekx4-full</option></entry>
741 <entry>10000</entry><entry>full</entry></row>
742
743 <row><entry><option>10000basekr-full</option></entry>
744 <entry>10000</entry><entry>full</entry></row>
745
746 <row><entry><option>10000baser-fec</option></entry>
747 <entry>10000</entry><entry>full</entry></row>
748
749 <row><entry><option>20000basemld2-full</option></entry>
750 <entry>20000</entry><entry>full</entry></row>
751
752 <row><entry><option>20000basekr2-full</option></entry>
753 <entry>20000</entry><entry>full</entry></row>
754 </tbody>
755 </tgroup>
756 </table>
757
758 By default this is unset, i.e. all possible modes will be advertised.
759 This option may be specified more than once, in which case all specified speeds and modes are advertised.
760 If the empty string is assigned to this option, the list is reset, and all prior assignments have no effect.
761 </para>
762 </listitem>
763 </varlistentry>
764 <varlistentry>
765 <term><varname>ReceiveChecksumOffload=</varname></term>
766 <listitem>
767 <para>Takes a boolean. If set to true, hardware offload for checksumming of ingress
768 network packets is enabled. When unset, the kernel's default will be used.</para>
769 </listitem>
770 </varlistentry>
771 <varlistentry>
772 <term><varname>TransmitChecksumOffload=</varname></term>
773 <listitem>
774 <para>Takes a boolean. If set to true, hardware offload for checksumming of egress
775 network packets is enabled. When unset, the kernel's default will be used.</para>
776 </listitem>
777 </varlistentry>
778 <varlistentry>
779 <term><varname>TCPSegmentationOffload=</varname></term>
780 <listitem>
781 <para>Takes a boolean. If set to true, TCP Segmentation Offload (TSO) is enabled.
782 When unset, the kernel's default will be used.</para>
783 </listitem>
784 </varlistentry>
785 <varlistentry>
786 <term><varname>TCP6SegmentationOffload=</varname></term>
787 <listitem>
788 <para>Takes a boolean. If set to true, TCP6 Segmentation Offload (tx-tcp6-segmentation) is enabled.
789 When unset, the kernel's default will be used.</para>
790 </listitem>
791 </varlistentry>
792 <varlistentry>
793 <term><varname>GenericSegmentationOffload=</varname></term>
794 <listitem>
795 <para>Takes a boolean. If set to true, Generic Segmentation Offload (GSO) is enabled.
796 When unset, the kernel's default will be used.</para>
797 </listitem>
798 </varlistentry>
799 <varlistentry>
800 <term><varname>GenericReceiveOffload=</varname></term>
801 <listitem>
802 <para>Takes a boolean. If set to true, Generic Receive Offload (GRO) is enabled.
803 When unset, the kernel's default will be used.</para>
804 </listitem>
805 </varlistentry>
806 <varlistentry>
807 <term><varname>GenericReceiveOffloadHardware=</varname></term>
808 <listitem>
809 <para>Takes a boolean. If set to true, hardware accelerated Generic Receive Offload (GRO) is
810 enabled. When unset, the kernel's default will be used.</para>
811 </listitem>
812 </varlistentry>
813 <varlistentry>
814 <term><varname>LargeReceiveOffload=</varname></term>
815 <listitem>
816 <para>Takes a boolean. If set to true, Large Receive Offload (LRO) is enabled.
817 When unset, the kernel's default will be used.</para>
818 </listitem>
819 </varlistentry>
820 <varlistentry>
821 <term><varname>ReceiveVLANCTAGHardwareAcceleration=</varname></term>
822 <listitem>
823 <para>Takes a boolean. If set to true, receive VLAN CTAG hardware acceleration is enabled.
824 When unset, the kernel's default will be used.</para>
825 </listitem>
826 </varlistentry>
827 <varlistentry>
828 <term><varname>TransmitVLANCTAGHardwareAcceleration=</varname></term>
829 <listitem>
830 <para>Takes a boolean. If set to true, transmit VLAN CTAG hardware acceleration is enabled.
831 When unset, the kernel's default will be used.</para>
832 </listitem>
833 </varlistentry>
834 <varlistentry>
835 <term><varname>ReceiveVLANCTAGFilter=</varname></term>
836 <listitem>
837 <para>Takes a boolean. If set to true, receive filtering on VLAN CTAGs is enabled.
838 When unset, the kernel's default will be used.</para>
839 </listitem>
840 </varlistentry>
841 <varlistentry>
842 <term><varname>TransmitVLANSTAGHardwareAcceleration=</varname></term>
843 <listitem>
844 <para>Takes a boolean. If set to true, transmit VLAN STAG hardware acceleration is enabled.
845 When unset, the kernel's default will be used.</para>
846 </listitem>
847 </varlistentry>
848 <varlistentry>
849 <term><varname>NTupleFilter=</varname></term>
850 <listitem>
851 <para>Takes a boolean. If set to true, receive N-tuple filters and actions are enabled.
852 When unset, the kernel's default will be used.</para>
853 </listitem>
854 </varlistentry>
855 <varlistentry>
856 <term><varname>RxChannels=</varname></term>
857 <term><varname>TxChannels=</varname></term>
858 <term><varname>OtherChannels=</varname></term>
859 <term><varname>CombinedChannels=</varname></term>
860 <listitem>
861 <para>Specifies the number of receive, transmit, other, or combined channels, respectively.
862 Takes an unsigned integer in the range 14294967295 or <literal>max</literal>. If set to
863 <literal>max</literal>, the advertised maximum value of the hardware will be used. When
864 unset, the number will not be changed. Defaults to unset.</para>
865 </listitem>
866 </varlistentry>
867 <varlistentry>
868 <term><varname>RxBufferSize=</varname></term>
869 <term><varname>RxMiniBufferSize=</varname></term>
870 <term><varname>RxJumboBufferSize=</varname></term>
871 <term><varname>TxBufferSize=</varname></term>
872 <listitem>
873 <para>Specifies the maximum number of pending packets in the NIC receive buffer, mini receive
874 buffer, jumbo receive buffer, or transmit buffer, respectively. Takes an unsigned integer in
875 the range 14294967295 or <literal>max</literal>. If set to <literal>max</literal>, the
876 advertised maximum value of the hardware will be used. When unset, the number will not be
877 changed. Defaults to unset.</para>
878 </listitem>
879 </varlistentry>
880 <varlistentry>
881 <term><varname>RxFlowControl=</varname></term>
882 <listitem>
883 <para>Takes a boolean. When set, enables receive flow control, also known as the ethernet
884 receive PAUSE message (generate and send ethernet PAUSE frames). When unset, the kernel's
885 default will be used.</para>
886 </listitem>
887 </varlistentry>
888 <varlistentry>
889 <term><varname>TxFlowControl=</varname></term>
890 <listitem>
891 <para>Takes a boolean. When set, enables transmit flow control, also known as the ethernet
892 transmit PAUSE message (respond to received ethernet PAUSE frames). When unset, the kernel's
893 default will be used.</para>
894 </listitem>
895 </varlistentry>
896 <varlistentry>
897 <term><varname>AutoNegotiationFlowControl=</varname></term>
898 <listitem>
899 <para>Takes a boolean. When set, auto negotiation enables the interface to exchange state
900 advertisements with the connected peer so that the two devices can agree on the ethernet
901 PAUSE configuration. When unset, the kernel's default will be used.</para>
902 </listitem>
903 </varlistentry>
904 <varlistentry>
905 <term><varname>GenericSegmentOffloadMaxBytes=</varname></term>
906 <listitem>
907 <para>Specifies the maximum size of a Generic Segment Offload (GSO) packet the
908 device should accept. The usual suffixes K, M, G are supported and are
909 understood to the base of 1024. An unsigned integer in the range 165536.
910 Defaults to unset.</para>
911 </listitem>
912 </varlistentry>
913 <varlistentry>
914 <term><varname>GenericSegmentOffloadMaxSegments=</varname></term>
915 <listitem>
916 <para>Specifies the maximum number of Generic Segment Offload (GSO) segments the device should
917 accept. An unsigned integer in the range 165535. Defaults to unset.</para>
918 </listitem>
919 </varlistentry>
920 <varlistentry>
921 <term><varname>UseAdaptiveRxCoalesce=</varname></term>
922 <term><varname>UseAdaptiveTxCoalesce=</varname></term>
923 <listitem>
924 <para>Boolean properties that, when set, enable/disable adaptive Rx/Tx coalescing if the hardware
925 supports it. When unset, the kernel's default will be used.</para>
926 </listitem>
927 </varlistentry>
928 <varlistentry>
929 <term><varname>RxCoalesceSec=</varname></term>
930 <term><varname>RxCoalesceIrqSec=</varname></term>
931 <term><varname>RxCoalesceLowSec=</varname></term>
932 <term><varname>RxCoalesceHighSec=</varname></term>
933 <term><varname>TxCoalesceSec=</varname></term>
934 <term><varname>TxCoalesceIrqSec=</varname></term>
935 <term><varname>TxCoalesceLowSec=</varname></term>
936 <term><varname>TxCoalesceHighSec=</varname></term>
937 <listitem>
938 <para>These properties configure the delay before Rx/Tx interrupts are generated after a packet is
939 sent/received. The <literal>Irq</literal> properties come into effect when the host is servicing an
940 IRQ. The <literal>Low</literal> and <literal>High</literal> properties come into effect when the
941 packet rate drops below the low packet rate threshold or exceeds the high packet rate threshold
942 respectively if adaptive Rx/Tx coalescing is enabled. When unset, the kernel's defaults will be
943 used.</para>
944 </listitem>
945 </varlistentry>
946 <varlistentry>
947 <term><varname>RxMaxCoalescedFrames=</varname></term>
948 <term><varname>RxMaxCoalescedIrqFrames=</varname></term>
949 <term><varname>RxMaxCoalescedLowFrames=</varname></term>
950 <term><varname>RxMaxCoalescedHighFrames=</varname></term>
951 <term><varname>TxMaxCoalescedFrames=</varname></term>
952 <term><varname>TxMaxCoalescedIrqFrames=</varname></term>
953 <term><varname>TxMaxCoalescedLowFrames=</varname></term>
954 <term><varname>TxMaxCoalescedHighFrames=</varname></term>
955 <listitem>
956 <para>These properties configure the maximum number of frames that are sent/received before a Rx/Tx
957 interrupt is generated. The <literal>Irq</literal> properties come into effect when the host is
958 servicing an IRQ. The <literal>Low</literal> and <literal>High</literal> properties come into
959 effect when the packet rate drops below the low packet rate threshold or exceeds the high packet
960 rate threshold respectively if adaptive Rx/Tx coalescing is enabled. When unset, the kernel's
961 defaults will be used.</para>
962 </listitem>
963 </varlistentry>
964 <varlistentry>
965 <term><varname>CoalescePacketRateLow=</varname></term>
966 <term><varname>CoalescePacketRateHigh=</varname></term>
967 <listitem>
968 <para>These properties configure the low and high packet rate (expressed in packets per second)
969 threshold respectively and are used to determine when the corresponding coalescing settings for low
970 and high packet rates come into effect if adaptive Rx/Tx coalescing is enabled. If unset, the
971 kernel's defaults will be used.</para>
972 </listitem>
973 </varlistentry>
974 <varlistentry>
975 <term><varname>CoalescePacketRateSampleIntervalSec=</varname></term>
976 <listitem>
977 <para>Configures how often to sample the packet rate used for adaptive Rx/Tx coalescing. This
978 property cannot be zero. This lowest time granularity supported by this property is seconds.
979 Partial seconds will be rounded up before being passed to the kernel. If unset, the kernel's
980 default will be used.</para>
981 </listitem>
982 </varlistentry>
983 <varlistentry>
984 <term><varname>StatisticsBlockCoalesceSec=</varname></term>
985 <listitem>
986 <para>How long to delay driver in-memory statistics block updates. If the driver does not have an
987 in-memory statistic block, this property is ignored. This property cannot be zero. If unset, the
988 kernel's default will be used.</para>
989 </listitem>
990 </varlistentry>
991
992 <varlistentry>
993 <term><varname>MDI=</varname></term>
994 <listitem>
995 <para>Specifies the medium dependent interface (MDI) mode for the interface. A MDI describes
996 the interface from a physical layer implementation to the physical medium used to carry the
997 transmission. Takes one of the following words: <literal>straight</literal> (or equivalently:
998 <literal>mdi</literal>), <literal>crossover</literal> (or equivalently:
999 <literal>mdi-x</literal>, <literal>mdix</literal>), and <literal>auto</literal>. When
1000 <literal>straight</literal>, the MDI straight through mode will be used. When
1001 <literal>crossover</literal>, the MDI crossover (MDI-X) mode will be used. When
1002 <literal>auto</literal>, the MDI status is automatically detected. Defaults to unset, and the
1003 kernel's default will be used.</para>
1004 </listitem>
1005 </varlistentry>
1006
1007 <varlistentry>
1008 <term><varname>SR-IOVVirtualFunctions=</varname></term>
1009 <listitem>
1010 <para>Specifies the number of SR-IOV virtual functions. Takes an integer in the range
1011 02147483647. Defaults to unset, and automatically determined from the values specified in
1012 the <varname>VirtualFunction=</varname> settings in the [SR-IOV] sections.</para>
1013 </listitem>
1014 </varlistentry>
1015
1016 </variablelist>
1017 </refsect1>
1018
1019 <refsect1 id='sr-iov'>
1020 <title>[SR-IOV] Section Options</title>
1021 <para>The [SR-IOV] section accepts the following keys. Specify several [SR-IOV] sections to
1022 configure several SR-IOVs. SR-IOV provides the ability to partition a single physical PCI resource
1023 into virtual PCI functions which can then be injected into a VM. In the case of network VFs, SR-IOV
1024 improves north-south network performance (that is, traffic with endpoints outside the host machine)
1025 by allowing traffic to bypass the host machine’s network stack.</para>
1026
1027 <variablelist class='network-directives'>
1028 <varlistentry>
1029 <term><varname>VirtualFunction=</varname></term>
1030 <listitem>
1031 <para>Specifies a Virtual Function (VF), lightweight PCIe function designed solely to move
1032 data in and out. Takes an integer in the range 02147483646. This option is compulsory.
1033 </para>
1034 </listitem>
1035 </varlistentry>
1036
1037 <varlistentry>
1038 <term><varname>VLANId=</varname></term>
1039 <listitem>
1040 <para>Specifies VLAN ID of the virtual function. Takes an integer in the range 14095.</para>
1041 </listitem>
1042 </varlistentry>
1043
1044 <varlistentry>
1045 <term><varname>QualityOfService=</varname></term>
1046 <listitem>
1047 <para>Specifies quality of service of the virtual function. Takes an integer in the range
1048 14294967294.</para>
1049 </listitem>
1050 </varlistentry>
1051
1052 <varlistentry>
1053 <term><varname>VLANProtocol=</varname></term>
1054 <listitem>
1055 <para>Specifies VLAN protocol of the virtual function. Takes <literal>802.1Q</literal> or
1056 <literal>802.1ad</literal>.</para>
1057 </listitem>
1058 </varlistentry>
1059
1060 <varlistentry>
1061 <term><varname>MACSpoofCheck=</varname></term>
1062 <listitem>
1063 <para>Takes a boolean. Controls the MAC spoof checking. When unset, the kernel's default will
1064 be used.</para>
1065 </listitem>
1066 </varlistentry>
1067
1068 <varlistentry>
1069 <term><varname>QueryReceiveSideScaling=</varname></term>
1070 <listitem>
1071 <para>Takes a boolean. Toggle the ability of querying the receive side scaling (RSS)
1072 configuration of the virtual function (VF). The VF RSS information like RSS hash key may be
1073 considered sensitive on some devices where this information is shared between VF and the
1074 physical function (PF). When unset, the kernel's default will be used.</para>
1075 </listitem>
1076 </varlistentry>
1077
1078 <varlistentry>
1079 <term><varname>Trust=</varname></term>
1080 <listitem>
1081 <para>Takes a boolean. Allows one to set trust mode of the virtual function (VF). When set,
1082 VF users can set a specific feature which may impact security and/or performance. When unset,
1083 the kernel's default will be used.</para>
1084 </listitem>
1085 </varlistentry>
1086
1087 <varlistentry>
1088 <term><varname>LinkState=</varname></term>
1089 <listitem>
1090 <para>Allows one to set the link state of the virtual function (VF). Takes a boolean or a
1091 special value <literal>auto</literal>. Setting to <literal>auto</literal> means a
1092 reflection of the physical function (PF) link state, <literal>yes</literal> lets the VF to
1093 communicate with other VFs on this host even if the PF link state is down,
1094 <literal>no</literal> causes the hardware to drop any packets sent by the VF. When unset,
1095 the kernel's default will be used.</para>
1096 </listitem>
1097 </varlistentry>
1098
1099 <varlistentry>
1100 <term><varname>MACAddress=</varname></term>
1101 <listitem>
1102 <para>Specifies the MAC address for the virtual function.</para>
1103 </listitem>
1104 </varlistentry>
1105 </variablelist>
1106 </refsect1>
1107
1108 <refsect1>
1109 <title>Examples</title>
1110
1111 <example>
1112 <title>/usr/lib/systemd/network/99-default.link</title>
1113
1114 <para>The link file <filename>99-default.link</filename> that is shipped with systemd defines the
1115 default policies for the interface name, alternative names, and MAC address of links.</para>
1116
1117 <programlisting>[Match]
1118 OriginalName=*
1119
1120 [Link]
1121 NamePolicy=keep kernel database onboard slot path
1122 AlternativeNamesPolicy=database onboard slot path
1123 MACAddressPolicy=persistent</programlisting>
1124 </example>
1125
1126 <example>
1127 <title>/etc/systemd/network/10-dmz.link</title>
1128
1129 <para>This example assigns the fixed name <literal>dmz0</literal> to the interface with the MAC address
1130 00:a0:de:63:7a:e6:</para>
1131
1132 <programlisting>[Match]
1133 MACAddress=00:a0:de:63:7a:e6
1134
1135 [Link]
1136 Name=dmz0</programlisting>
1137
1138 <para><varname>NamePolicy=</varname> is not set, so <varname>Name=</varname> takes effect. We use the
1139 <literal>10-</literal> prefix to order this file early in the list. Note that it needs to be before
1140 <filename>99-default.link</filename>, i.e. it needs a numerical prefix, to have any effect at all.</para>
1141 </example>
1142
1143 <example>
1144 <title>Debugging <varname>NamePolicy=</varname> assignments</title>
1145
1146 <programlisting>$ sudo SYSTEMD_LOG_LEVEL=debug udevadm test-builtin net_setup_link /sys/class/net/hub0
1147
1148 Parsed configuration file /usr/lib/systemd/network/99-default.link
1149 Parsed configuration file /etc/systemd/network/10-eth0.link
1150 ID_NET_DRIVER=cdc_ether
1151 Config file /etc/systemd/network/10-eth0.link applies to device hub0
1152 link_config: autonegotiation is unset or enabled, the speed and duplex are not writable.
1153 hub0: Device has name_assign_type=4
1154 Using default interface naming scheme 'v240'.
1155 hub0: Policies didn't yield a name, using specified Name=hub0.
1156 ID_NET_LINK_FILE=/etc/systemd/network/10-eth0.link
1157 ID_NET_NAME=hub0
1158</programlisting>
1159
1160 <para>Explicit <varname>Name=</varname> configuration wins in this case.</para>
1161
1162 <programlisting>sudo SYSTEMD_LOG_LEVEL=debug udevadm test-builtin net_setup_link /sys/class/net/enp0s31f6
1163
1164 Parsed configuration file /usr/lib/systemd/network/99-default.link
1165 Parsed configuration file /etc/systemd/network/10-eth0.link
1166 Created link configuration context.
1167 ID_NET_DRIVER=e1000e
1168 Config file /usr/lib/systemd/network/99-default.link applies to device enp0s31f6
1169 link_config: autonegotiation is unset or enabled, the speed and duplex are not writable.
1170 enp0s31f6: Device has name_assign_type=4
1171 Using default interface naming scheme 'v240'.
1172 enp0s31f6: Policy *keep*: keeping existing userspace name
1173 enp0s31f6: Device has addr_assign_type=0
1174 enp0s31f6: MAC on the device already matches policy *persistent*
1175 ID_NET_LINK_FILE=/usr/lib/systemd/network/99-default.link
1176
1177 </programlisting>
1178
1179 <para>In this case, the interface was already renamed, so the <option>keep</option> policy specified as
1180 the first option in <filename index="false">99-default.link</filename> means that the existing name is
1181 preserved. If <option>keep</option> was removed, or if were in boot before the renaming has happened,
1182 we might get the following instead:</para>
1183
1184 <programlisting>enp0s31f6: Policy *path* yields "enp0s31f6".
1185 enp0s31f6: Device has addr_assign_type=0
1186 enp0s31f6: MAC on the device already matches policy *persistent*
1187 ID_NET_LINK_FILE=/usr/lib/systemd/network/99-default.link
1188 ID_NET_NAME=enp0s31f6
1189
1190 </programlisting>
1191
1192 <para>Please note that the details of output are subject to change.</para>
1193 </example>
1194
1195 <example>
1196 <title>/etc/systemd/network/10-internet.link</title>
1197
1198 <para>This example assigns the fixed name
1199 <literal>internet0</literal> to the interface with the device
1200 path <literal>pci-0000:00:1a.0-*</literal>:</para>
1201
1202 <programlisting>[Match]
1203 Path=pci-0000:00:1a.0-*
1204
1205 [Link]
1206 Name=internet0</programlisting>
1207 </example>
1208
1209 <example>
1210 <title>/etc/systemd/network/25-wireless.link</title>
1211
1212 <para>Here's an overly complex example that shows the use of a large number of [Match] and [Link] settings.</para>
1213
1214 <programlisting>[Match]
1215 MACAddress=12:34:56:78:9a:bc
1216 Driver=brcmsmac
1217 Path=pci-0000:02:00.0-*
1218 Type=wlan
1219 Virtualization=no
1220 Host=my-laptop
1221 Architecture=x86-64
1222
1223 [Link]
1224 Name=wireless0
1225 MTUBytes=1450
1226 BitsPerSecond=10M
1227 WakeOnLan=magic
1228 MACAddress=cb:a9:87:65:43:21</programlisting>
1229 </example>
1230 </refsect1>
1231
1232 <refsect1>
1233 <title>See Also</title>
1234 <para>
1235 <citerefentry>
1236 <refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum>
1237 </citerefentry>,
1238 <citerefentry>
1239 <refentrytitle>udevadm</refentrytitle><manvolnum>8</manvolnum>
1240 </citerefentry>,
1241 <citerefentry>
1242 <refentrytitle>systemd.netdev</refentrytitle><manvolnum>5</manvolnum>
1243 </citerefentry>,
1244 <citerefentry>
1245 <refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum>
1246 </citerefentry>,
1247 <citerefentry>
1248 <refentrytitle>systemd-network-generator.service</refentrytitle><manvolnum>8</manvolnum>
1249 </citerefentry>
1250 </para>
1251 </refsect1>
1252
1253 </refentry>