]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd.link.xml
Merge pull request #20826 from yuwata/network-sd-event-source-disable-unref
[thirdparty/systemd.git] / man / systemd.link.xml
CommitLineData
514094f9 1<?xml version='1.0'?>
3a54a157 2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
12b42c76 3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
db9ecf05 4<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
1ff28eae
TG
5
6<refentry id="systemd.link">
798d3a52
ZJS
7 <refentryinfo>
8 <title>systemd.link</title>
9 <productname>systemd</productname>
798d3a52 10 </refentryinfo>
1ff28eae 11
798d3a52
ZJS
12 <refmeta>
13 <refentrytitle>systemd.link</refentrytitle>
14 <manvolnum>5</manvolnum>
15 </refmeta>
1ff28eae 16
798d3a52
ZJS
17 <refnamediv>
18 <refname>systemd.link</refname>
19 <refpurpose>Network device configuration</refpurpose>
20 </refnamediv>
1ff28eae 21
798d3a52
ZJS
22 <refsynopsisdiv>
23 <para><filename><replaceable>link</replaceable>.link</filename></para>
24 </refsynopsisdiv>
1ff28eae 25
798d3a52
ZJS
26 <refsect1>
27 <title>Description</title>
1ff28eae 28
d4de2b2a 29 <para>A plain ini-style text file that encodes configuration for matching network devices, used by
55cf7779 30 <citerefentry><refentrytitle>systemd-udevd</refentrytitle><manvolnum>8</manvolnum></citerefentry> and in
d4de2b2a 31 particular its <command>net_setup_link</command> builtin. See
675fa6ea 32 <citerefentry><refentrytitle>systemd.syntax</refentrytitle><manvolnum>7</manvolnum></citerefentry> for a
d4de2b2a 33 general description of the syntax.</para>
1ff28eae 34
e406e8a2
YW
35 <para>The link files are read from the files located in the system network directory
36 <filename>/usr/lib/systemd/network</filename>, the volatile runtime network directory
37 <filename>/run/systemd/network</filename>, and the local administration network directory
38 <filename>/etc/systemd/network</filename>. Link files must have the extension
39 <filename>.link</filename>; other extensions are ignored. All link files are collectively sorted
40 and processed in lexical order, regardless of the directories in which they live. However, files
41 with identical filenames replace each other. Files in <filename>/etc/</filename> have the highest
42 priority, files in <filename>/run/</filename> take precedence over files with the same name in
43 <filename>/usr/lib/</filename>. This can be used to override a system-supplied link file with a
44 local file if needed. As a special case, an empty file (file size 0) or symlink with the same name
45 pointing to <filename>/dev/null</filename> disables the configuration file entirely (it is
46 "masked").</para>
47
48 <para>Along with the link file <filename>foo.link</filename>, a "drop-in" directory
49 <filename>foo.link.d/</filename> may exist. All files with the suffix <literal>.conf</literal>
e6655fbe
YW
50 from this directory will be merged in the alphanumeric order and parsed after the main file itself
51 has been parsed. This is useful to alter or add configuration settings, without having to modify
52 the main configuration file. Each drop-in file must have appropriate section headers.</para>
e406e8a2
YW
53
54 <para>In addition to <filename>/etc/systemd/network</filename>, drop-in <literal>.d</literal>
55 directories can be placed in <filename>/usr/lib/systemd/network</filename> or
56 <filename>/run/systemd/network</filename> directories. Drop-in files in <filename>/etc/</filename>
57 take precedence over those in <filename>/run/</filename> which in turn take precedence over those
58 in <filename>/usr/lib/</filename>. Drop-in files under any of these directories take precedence
59 over the main link file wherever located.</para>
1ff28eae 60
d7dce7b6
ZJS
61 <para>The link file contains a [Match] section, which determines if a given link file may be applied to a
62 given device, as well as a [Link] section specifying how the device should be configured. The first (in
63 lexical order) of the link files that matches a given device is applied. Note that a default file
64 <filename>99-default.link</filename> is shipped by the system. Any user-supplied
65 <filename>.link</filename> should hence have a lexically earlier name to be considered at all.</para>
66
67 <para>See <citerefentry><refentrytitle>udevadm</refentrytitle><manvolnum>8</manvolnum></citerefentry> for
68 diagnosing problems with <filename>.link</filename> files.</para>
798d3a52 69 </refsect1>
102bd40e 70
798d3a52
ZJS
71 <refsect1>
72 <title>[Match] Section Options</title>
1ff28eae 73
84ea567e 74 <para>A link file is said to match a device if all matches specified by the
bdac5608
ZJS
75 [Match] section are satisfied. When a link file does not contain valid settings
76 in [Match] section, then the file will match all devices and
84ea567e
YW
77 <command>systemd-udevd</command> warns about that. Hint: to avoid the warning and to make it clear
78 that all interfaces shall be matched, add the following:
79 <programlisting>OriginalName=*</programlisting>
80 The following keys are accepted:</para>
1ff28eae 81
798d3a52 82 <variablelist class='network-directives'>
d9b20454
ZJS
83 <!-- This list is reused in systemd.network(3), hence maintain a specific order:
84 1. device matches shared between the two lists
85 2. non-shared settings
86 3. host matches shared between the two lists
87 -->
88
89 <varlistentry id='mac-address'>
798d3a52
ZJS
90 <term><varname>MACAddress=</varname></term>
91 <listitem>
9310bf4b
YW
92 <para>A whitespace-separated list of hardware addresses. Use full colon-, hyphen- or dot-delimited hexadecimal. See the example below.
93 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
94 of hardware addresses defined prior to this is reset.</para>
95
96 <para>Example:
97 <programlisting>MACAddress=01:23:45:67:89:ab 00-11-22-33-44-55 AABB.CCDD.EEFF</programlisting></para>
798d3a52
ZJS
98 </listitem>
99 </varlistentry>
d9b20454
ZJS
100
101 <varlistentry id='permanent-mac-address'>
4bb7cc82
YW
102 <term><varname>PermanentMACAddress=</varname></term>
103 <listitem>
104 <para>A whitespace-separated list of hardware's permanent addresses. While
105 <varname>MACAddress=</varname> matches the device's current MAC address, this matches the
106 device's permanent MAC address, which may be different from the current one. Use full
107 colon-, hyphen- or dot-delimited hexadecimal. This option may appear more than once, in
108 which case the lists are merged. If the empty string is assigned to this option, the list
109 of hardware addresses defined prior to this is reset.</para>
110 </listitem>
111 </varlistentry>
d9b20454
ZJS
112
113 <varlistentry id='path'>
798d3a52
ZJS
114 <term><varname>Path=</varname></term>
115 <listitem>
5256e00e
TG
116 <para>A whitespace-separated list of shell-style globs matching
117 the persistent path, as exposed by the udev property
d7dce7b6 118 <varname>ID_PATH</varname>.</para>
798d3a52
ZJS
119 </listitem>
120 </varlistentry>
d9b20454
ZJS
121
122 <varlistentry id='driver'>
798d3a52
ZJS
123 <term><varname>Driver=</varname></term>
124 <listitem>
d7dce7b6 125 <para>A whitespace-separated list of shell-style globs matching the driver currently bound to the
d9b20454
ZJS
126 device, as exposed by the udev property <varname>ID_NET_DRIVER</varname> of its parent device, or
127 if that is not set, the driver as exposed by <command>ethtool -i</command> of the device itself.
128 If the list is prefixed with a "!", the test is inverted.</para>
798d3a52
ZJS
129 </listitem>
130 </varlistentry>
d9b20454
ZJS
131
132 <varlistentry id='type'>
798d3a52
ZJS
133 <term><varname>Type=</varname></term>
134 <listitem>
ef62949a 135 <para>A whitespace-separated list of shell-style globs matching the device type, as exposed by
2480ca95
LM
136 <command>networkctl list</command>. If the list is prefixed with a "!", the test is inverted.
137 Some valid values are <literal>ether</literal>, <literal>loopback</literal>, <literal>wlan</literal>, <literal>wwan</literal>.
138 Valid types are named either from the udev <literal>DEVTYPE</literal> attribute, or
139 <literal>ARPHRD_</literal> macros in <filename>linux/if_arp.h</filename>, so this is not comprehensive.
ef62949a 140 </para>
798d3a52
ZJS
141 </listitem>
142 </varlistentry>
d9b20454
ZJS
143
144 <varlistentry id='property'>
44005bfb
YW
145 <term><varname>Property=</varname></term>
146 <listitem>
387f6955 147 <para>A whitespace-separated list of udev property names with their values after equals sign
44005bfb
YW
148 (<literal>=</literal>). If multiple properties are specified, the test results are ANDed.
149 If the list is prefixed with a "!", the test is inverted. If a value contains white
150 spaces, then please quote whole key and value pair. If a value contains quotation, then
151 please escape the quotation with <literal>\</literal>.</para>
152
153 <para>Example: if a .link file has the following:
154 <programlisting>Property=ID_MODEL_ID=9999 "ID_VENDOR_FROM_DATABASE=vendor name" "KEY=with \"quotation\""</programlisting>
155 then, the .link file matches only when an interface has all the above three properties.
156 </para>
157 </listitem>
158 </varlistentry>
d9b20454 159
798d3a52 160 <varlistentry>
d9b20454
ZJS
161 <term><varname>OriginalName=</varname></term>
162 <listitem>
163 <para>A whitespace-separated list of shell-style globs matching the device name, as exposed by the
164 udev property "INTERFACE". This cannot be used to match on names that have already been changed
165 from userspace. Caution is advised when matching on kernel-assigned names, as they are known to be
166 unstable between reboots.</para>
167 </listitem>
168 </varlistentry>
169
170 <varlistentry id='host'>
798d3a52
ZJS
171 <term><varname>Host=</varname></term>
172 <listitem>
d689bbca 173 <para>Matches against the hostname or machine ID of the host. See <varname>ConditionHost=</varname> in
798d3a52 174 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
d689bbca
YW
175 for details. When prefixed with an exclamation mark (<literal>!</literal>), the result is negated.
176 If an empty string is assigned, then previously assigned value is cleared.
177 </para>
798d3a52
ZJS
178 </listitem>
179 </varlistentry>
d9b20454
ZJS
180
181 <varlistentry id='virtualization'>
798d3a52
ZJS
182 <term><varname>Virtualization=</varname></term>
183 <listitem>
d689bbca
YW
184 <para>Checks whether the system is executed in a virtualized environment and optionally test
185 whether it is a specific implementation. See <varname>ConditionVirtualization=</varname> in
798d3a52 186 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
d689bbca
YW
187 for details. When prefixed with an exclamation mark (<literal>!</literal>), the result is negated.
188 If an empty string is assigned, then previously assigned value is cleared.
189 </para>
798d3a52
ZJS
190 </listitem>
191 </varlistentry>
d9b20454
ZJS
192
193 <varlistentry id='kernel-command-line'>
798d3a52
ZJS
194 <term><varname>KernelCommandLine=</varname></term>
195 <listitem>
d689bbca 196 <para>Checks whether a specific kernel command line option is set. See
d7dce7b6 197 <varname>ConditionKernelCommandLine=</varname> in
798d3a52 198 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
d689bbca
YW
199 for details. When prefixed with an exclamation mark (<literal>!</literal>), the result is negated.
200 If an empty string is assigned, then previously assigned value is cleared.
201 </para>
202 </listitem>
203 </varlistentry>
d9b20454
ZJS
204
205 <varlistentry id='kernel-version'>
d689bbca
YW
206 <term><varname>KernelVersion=</varname></term>
207 <listitem>
208 <para>Checks whether the kernel version (as reported by <command>uname -r</command>) matches a certain
209 expression. See <varname>ConditionKernelVersion=</varname> in
210 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry> for
211 details. When prefixed with an exclamation mark (<literal>!</literal>), the result is negated.
212 If an empty string is assigned, then previously assigned value is cleared.
213 </para>
798d3a52
ZJS
214 </listitem>
215 </varlistentry>
d9b20454
ZJS
216
217 <varlistentry id='architecture'>
798d3a52
ZJS
218 <term><varname>Architecture=</varname></term>
219 <listitem>
d689bbca
YW
220 <para>Checks whether the system is running on a specific architecture. See
221 <varname>ConditionArchitecture=</varname> in
798d3a52 222 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
d689bbca
YW
223 for details. When prefixed with an exclamation mark (<literal>!</literal>), the result is negated.
224 If an empty string is assigned, then previously assigned value is cleared.
225 </para>
798d3a52 226 </listitem>
cbcdcaaa
UKK
227 </varlistentry>
228
229 <varlistentry id='firmware'>
230 <term><varname>Firmware=</varname></term>
231 <listitem>
232 <para>Checks whether the system is running on a machine with the specified firmware. See
233 <varname>ConditionFirmware=</varname> in
234 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
235 for details. When prefixed with an exclamation mark (<literal>!</literal>), the result is negated.
236 If an empty string is assigned, then previously assigned value is cleared.
237 </para>
238 </listitem>
798d3a52
ZJS
239 </varlistentry>
240 </variablelist>
1ff28eae 241
798d3a52 242 </refsect1>
102bd40e 243
798d3a52
ZJS
244 <refsect1>
245 <title>[Link] Section Options</title>
102bd40e 246
d7dce7b6 247 <para>The [Link] section accepts the following
798d3a52 248 keys:</para>
1ff28eae 249
798d3a52
ZJS
250 <variablelist class='network-directives'>
251 <varlistentry>
252 <term><varname>Description=</varname></term>
253 <listitem>
254 <para>A description of the device.</para>
255 </listitem>
256 </varlistentry>
257 <varlistentry>
258 <term><varname>Alias=</varname></term>
259 <listitem>
d7dce7b6 260 <para>The <varname>ifalias</varname> interface property is set to this value.</para>
798d3a52
ZJS
261 </listitem>
262 </varlistentry>
263 <varlistentry>
264 <term><varname>MACAddressPolicy=</varname></term>
265 <listitem>
266 <para>The policy by which the MAC address should be set. The
267 available policies are:
268 </para>
1ff28eae 269
798d3a52
ZJS
270 <variablelist>
271 <varlistentry>
d7dce7b6 272 <term><option>persistent</option></term>
798d3a52
ZJS
273 <listitem>
274 <para>If the hardware has a persistent MAC address, as
275 most hardware should, and if it is used by the kernel,
276 nothing is done. Otherwise, a new MAC address is
277 generated which is guaranteed to be the same on every
278 boot for the given machine and the given device, but
1c25683e 279 which is otherwise random. This feature depends on ID_NET_NAME_*
a8eaaee7 280 properties to exist for the link. On hardware where these
b938cb90 281 properties are not set, the generation of a persistent MAC address
1c25683e 282 will fail.</para>
798d3a52
ZJS
283 </listitem>
284 </varlistentry>
285 <varlistentry>
d7dce7b6 286 <term><option>random</option></term>
798d3a52
ZJS
287 <listitem>
288 <para>If the kernel is using a random MAC address,
289 nothing is done. Otherwise, a new address is randomly
290 generated each time the device appears, typically at
b938cb90 291 boot. Either way, the random address will have the
2e229e0c
TG
292 <literal>unicast</literal> and
293 <literal>locally administered</literal> bits set.</para>
798d3a52
ZJS
294 </listitem>
295 </varlistentry>
66d3752e 296 <varlistentry>
d7dce7b6 297 <term><option>none</option></term>
66d3752e 298 <listitem>
6ca4a070
YW
299 <para>Keeps the MAC address assigned by the kernel. Or use the MAC address specified in
300 <varname>MACAddress=</varname>.</para>
66d3752e
JK
301 </listitem>
302 </varlistentry>
798d3a52 303 </variablelist>
6ca4a070
YW
304
305 <para>An empty string assignment is equivalent to setting <literal>none</literal>.</para>
798d3a52
ZJS
306 </listitem>
307 </varlistentry>
308 <varlistentry>
309 <term><varname>MACAddress=</varname></term>
310 <listitem>
6ca4a070
YW
311 <para>The interface MAC address to use. For this setting to take effect,
312 <varname>MACAddressPolicy=</varname> must either be unset, empty, or <literal>none</literal>.
313 </para>
798d3a52
ZJS
314 </listitem>
315 </varlistentry>
316 <varlistentry>
317 <term><varname>NamePolicy=</varname></term>
318 <listitem>
3907446f 319 <para>An ordered, space-separated list of policies by which the interface name should be set.
d7dce7b6 320 <varname>NamePolicy=</varname> may be disabled by specifying <option>net.ifnames=0</option> on the
58576937 321 kernel command line. Each of the policies may fail, and the first successful one is used. The name
d7dce7b6 322 is not set directly, but is exported to udev as the property <option>ID_NET_NAME</option>, which
58576937
ZJS
323 is, by default, used by a
324 <citerefentry><refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
325 rule to set <varname>NAME</varname>. The available policies are:
3907446f 326 </para>
1ff28eae 327
798d3a52
ZJS
328 <variablelist>
329 <varlistentry>
d7dce7b6 330 <term><option>kernel</option></term>
798d3a52
ZJS
331 <listitem>
332 <para>If the kernel claims that the name it has set
333 for a device is predictable, then no renaming is
334 performed.</para>
335 </listitem>
336 </varlistentry>
337 <varlistentry>
d7dce7b6 338 <term><option>database</option></term>
798d3a52
ZJS
339 <listitem>
340 <para>The name is set based on entries in the udev's
341 Hardware Database with the key
d7dce7b6 342 <varname>ID_NET_NAME_FROM_DATABASE</varname>.
798d3a52
ZJS
343 </para>
344 </listitem>
345 </varlistentry>
346 <varlistentry>
d7dce7b6 347 <term><option>onboard</option></term>
798d3a52
ZJS
348 <listitem>
349 <para>The name is set based on information given by
350 the firmware for on-board devices, as exported by the
d7dce7b6 351 udev property <varname>ID_NET_NAME_ONBOARD</varname>.
0b1e5b6e 352 See <citerefentry><refentrytitle>systemd.net-naming-scheme</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
798d3a52
ZJS
353 </para>
354 </listitem>
355 </varlistentry>
356 <varlistentry>
d7dce7b6 357 <term><option>slot</option></term>
798d3a52
ZJS
358 <listitem>
359 <para>The name is set based on information given by
360 the firmware for hot-plug devices, as exported by the
d7dce7b6 361 udev property <varname>ID_NET_NAME_SLOT</varname>.
0b1e5b6e 362 See <citerefentry><refentrytitle>systemd.net-naming-scheme</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
798d3a52
ZJS
363 </para>
364 </listitem>
365 </varlistentry>
366 <varlistentry>
d7dce7b6 367 <term><option>path</option></term>
798d3a52
ZJS
368 <listitem>
369 <para>The name is set based on the device's physical
370 location, as exported by the udev property
0b1e5b6e
ZJS
371 <varname>ID_NET_NAME_PATH</varname>.
372 See <citerefentry><refentrytitle>systemd.net-naming-scheme</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
373 </para>
798d3a52
ZJS
374 </listitem>
375 </varlistentry>
376 <varlistentry>
d7dce7b6 377 <term><option>mac</option></term>
798d3a52
ZJS
378 <listitem>
379 <para>The name is set based on the device's persistent
380 MAC address, as exported by the udev property
0b1e5b6e
ZJS
381 <varname>ID_NET_NAME_MAC</varname>.
382 See <citerefentry><refentrytitle>systemd.net-naming-scheme</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
383 </para>
798d3a52
ZJS
384 </listitem>
385 </varlistentry>
3907446f 386 <varlistentry>
d7dce7b6 387 <term><option>keep</option></term>
3907446f
ZJS
388 <listitem>
389 <para>If the device already had a name given by userspace (as part of creation of the device
390 or a rename), keep it.</para>
798d3a52
ZJS
391 </listitem>
392 </varlistentry>
393 </variablelist>
394 </listitem>
395 </varlistentry>
396 <varlistentry>
397 <term><varname>Name=</varname></term>
398 <listitem>
58576937
ZJS
399 <para>The interface name to use. This option has lower precedence than
400 <varname>NamePolicy=</varname>, so for this setting to take effect, <varname>NamePolicy=</varname>
401 must either be unset, empty, disabled, or all policies configured there must fail. Also see the
402 example below with <literal>Name=dmz0</literal>.</para>
1b934761
ZJS
403
404 <para>Note that specifying a name that the kernel might use for another
405 interface (for example <literal>eth0</literal>) is dangerous because the
406 name assignment done by udev will race with the assignment done by the
407 kernel, and only one interface may use the name. Depending on the order of
408 operations, either udev or the kernel will win, making the naming
409 unpredictable. It is best to use some different prefix, for example
410 <literal>internal0</literal>/<literal>external0</literal> or
411 <literal>lan0</literal>/<literal>lan1</literal>/<literal>lan3</literal>.
412 </para>
798d3a52
ZJS
413 </listitem>
414 </varlistentry>
ef1d2c07
YW
415 <varlistentry>
416 <term><varname>AlternativeNamesPolicy=</varname></term>
417 <listitem>
418 <para>A space-separated list of policies by which the interface's alternative names
419 should be set. Each of the policies may fail, and all successful policies are used. The
420 available policies are <literal>database</literal>, <literal>onboard</literal>,
421 <literal>slot</literal>, <literal>path</literal>, and <literal>mac</literal>. If the
422 kernel does not support the alternative names, then this setting will be ignored.
423 </para>
424 </listitem>
425 </varlistentry>
a5053a15
YW
426 <varlistentry>
427 <term><varname>AlternativeName=</varname></term>
428 <listitem>
429 <para>The alternative interface name to use. This option can be specified multiple times.
430 If the empty string is assigned to this option, the list is reset, and all prior assignments
bb181dd4
YW
431 have no effect. If the kernel does not support the alternative names, then this setting will
432 be ignored.</para>
a5053a15
YW
433 </listitem>
434 </varlistentry>
face9fcc
YW
435 <varlistentry>
436 <term><varname>TransmitQueues=</varname></term>
437 <listitem>
438 <para>Specifies the device's number of transmit queues. An integer in the range 1…4096.
439 When unset, the kernel's default will be used.</para>
440 </listitem>
441 </varlistentry>
442 <varlistentry>
443 <term><varname>ReceiveQueues=</varname></term>
444 <listitem>
445 <para>Specifies the device's number of receive queues. An integer in the range 1…4096.
446 When unset, the kernel's default will be used.</para>
447 </listitem>
448 </varlistentry>
ef4a91a7 449 <varlistentry>
1f8dc96c 450 <term><varname>TransmitQueueLength=</varname></term>
ef4a91a7
451 <listitem>
452 <para>Specifies the transmit queue length of the device in number of packets. An unsigned integer
1d3a473b 453 in the range 0…4294967294. When unset, the kernel's default will be used.</para>
ef4a91a7
454 </listitem>
455 </varlistentry>
798d3a52
ZJS
456 <varlistentry>
457 <term><varname>MTUBytes=</varname></term>
458 <listitem>
459 <para>The maximum transmission unit in bytes to set for the
be0d27ee 460 device. The usual suffixes K, M, G are supported and are
798d3a52
ZJS
461 understood to the base of 1024.</para>
462 </listitem>
463 </varlistentry>
464 <varlistentry>
465 <term><varname>BitsPerSecond=</varname></term>
466 <listitem>
467 <para>The speed to set for the device, the value is rounded
be0d27ee 468 down to the nearest Mbps. The usual suffixes K, M, G are
798d3a52
ZJS
469 supported and are understood to the base of 1000.</para>
470 </listitem>
471 </varlistentry>
472 <varlistentry>
473 <term><varname>Duplex=</varname></term>
474 <listitem>
d7dce7b6
ZJS
475 <para>The duplex mode to set for the device. The accepted values are <option>half</option> and
476 <option>full</option>.</para>
798d3a52
ZJS
477 </listitem>
478 </varlistentry>
a39f92d3
SS
479 <varlistentry>
480 <term><varname>AutoNegotiation=</varname></term>
481 <listitem>
9b6ffef3 482 <para>Takes a boolean. If set to yes, automatic negotiation of transmission parameters is enabled.
a39f92d3
SS
483 Autonegotiation is a procedure by which two connected ethernet devices choose
484 common transmission parameters, such as speed, duplex mode, and flow control.
9b6ffef3 485 When unset, the kernel's default will be used.</para>
a39f92d3 486
a0e1ad10 487 <para>Note that if autonegotiation is enabled, speed and duplex settings are
11fcfc53 488 read-only. If autonegotiation is disabled, speed and duplex settings are writable
a39f92d3
SS
489 if the driver supports multiple link modes.</para>
490 </listitem>
491 </varlistentry>
798d3a52
ZJS
492 <varlistentry>
493 <term><varname>WakeOnLan=</varname></term>
494 <listitem>
c50404ae
YW
495 <para>The Wake-on-LAN policy to set for the device. Takes the special value
496 <literal>off</literal> which disables Wake-on-LAN, or space separated list of the following
497 words:</para>
1ff28eae 498
798d3a52
ZJS
499 <variablelist>
500 <varlistentry>
d7dce7b6 501 <term><option>phy</option></term>
798d3a52
ZJS
502 <listitem>
503 <para>Wake on PHY activity.</para>
504 </listitem>
505 </varlistentry>
617da14c 506 <varlistentry>
d7dce7b6 507 <term><option>unicast</option></term>
617da14c
SS
508 <listitem>
509 <para>Wake on unicast messages.</para>
510 </listitem>
511 </varlistentry>
512 <varlistentry>
d7dce7b6 513 <term><option>multicast</option></term>
617da14c
SS
514 <listitem>
515 <para>Wake on multicast messages.</para>
516 </listitem>
517 </varlistentry>
518 <varlistentry>
d7dce7b6 519 <term><option>broadcast</option></term>
617da14c
SS
520 <listitem>
521 <para>Wake on broadcast messages.</para>
522 </listitem>
523 </varlistentry>
524 <varlistentry>
d7dce7b6 525 <term><option>arp</option></term>
617da14c
SS
526 <listitem>
527 <para>Wake on ARP.</para>
528 </listitem>
529 </varlistentry>
798d3a52 530 <varlistentry>
d7dce7b6 531 <term><option>magic</option></term>
798d3a52
ZJS
532 <listitem>
533 <para>Wake on receipt of a magic packet.
534 </para>
535 </listitem>
536 </varlistentry>
617da14c 537 <varlistentry>
d7dce7b6 538 <term><option>secureon</option></term>
617da14c
SS
539 <listitem>
540 <para>Enable secureon(tm) password for MagicPacket(tm).
541 </para>
542 </listitem>
543 </varlistentry>
798d3a52 544 </variablelist>
c605bd00 545
c50404ae
YW
546 <para>Defaults to unset, and the device's default will be used. This setting can be specified
547 multiple times. If an empty string is assigned, then the all previous assignments are
548 cleared.</para>
798d3a52
ZJS
549 </listitem>
550 </varlistentry>
593022fa
SS
551 <varlistentry>
552 <term><varname>Port=</varname></term>
553 <listitem>
554 <para>The port option is used to select the device port. The
555 supported values are:</para>
556
557 <variablelist>
558 <varlistentry>
d7dce7b6 559 <term><option>tp</option></term>
593022fa
SS
560 <listitem>
561 <para>An Ethernet interface using Twisted-Pair cable as the medium.</para>
562 </listitem>
563 </varlistentry>
564 <varlistentry>
d7dce7b6 565 <term><option>aui</option></term>
593022fa
SS
566 <listitem>
567 <para>Attachment Unit Interface (AUI). Normally used with hubs.
568 </para>
569 </listitem>
570 </varlistentry>
571 <varlistentry>
d7dce7b6 572 <term><option>bnc</option></term>
593022fa
SS
573 <listitem>
574 <para>An Ethernet interface using BNC connectors and co-axial cable.</para>
575 </listitem>
576 </varlistentry>
577 <varlistentry>
d7dce7b6 578 <term><option>mii</option></term>
593022fa
SS
579 <listitem>
580 <para>An Ethernet interface using a Media Independent Interface (MII).</para>
581 </listitem>
582 </varlistentry>
583 <varlistentry>
d7dce7b6 584 <term><option>fibre</option></term>
593022fa
SS
585 <listitem>
586 <para>An Ethernet interface using Optical Fibre as the medium.</para>
587 </listitem>
588 </varlistentry>
589 </variablelist>
590 </listitem>
591 </varlistentry>
6cf0a204
SS
592 <varlistentry>
593 <term><varname>Advertise=</varname></term>
594 <listitem>
595 <para>This sets what speeds and duplex modes of operation are advertised for auto-negotiation.
a0e1ad10 596 This implies <literal>AutoNegotiation=yes</literal>. The supported values are:
6cf0a204
SS
597
598 <table>
599 <title>Supported advertise values</title>
600 <tgroup cols='3'>
601 <colspec colname='Advertise' />
602 <colspec colname='Speed' />
603 <colspec colname='Duplex Mode' />
604
605 <thead><row>
606 <entry>Advertise</entry>
607 <entry>Speed (Mbps)</entry>
608 <entry>Duplex Mode</entry>
609 </row></thead>
610 <tbody>
d7dce7b6 611 <row><entry><option>10baset-half</option></entry>
6cf0a204
SS
612 <entry>10</entry><entry>half</entry></row>
613
d7dce7b6 614 <row><entry><option>10baset-full</option></entry>
6cf0a204
SS
615 <entry>10</entry><entry>full</entry></row>
616
d7dce7b6 617 <row><entry><option>100baset-half</option></entry>
6cf0a204
SS
618 <entry>100</entry><entry>half</entry></row>
619
d7dce7b6 620 <row><entry><option>100baset-full</option></entry>
6cf0a204
SS
621 <entry>100</entry><entry>full</entry></row>
622
d7dce7b6 623 <row><entry><option>1000baset-half</option></entry>
6cf0a204
SS
624 <entry>1000</entry><entry>half</entry></row>
625
d7dce7b6 626 <row><entry><option>1000baset-full</option></entry>
6cf0a204
SS
627 <entry>1000</entry><entry>full</entry></row>
628
d7dce7b6 629 <row><entry><option>10000baset-full</option></entry>
6cf0a204
SS
630 <entry>10000</entry><entry>full</entry></row>
631
d7dce7b6 632 <row><entry><option>2500basex-full</option></entry>
6cf0a204
SS
633 <entry>2500</entry><entry>full</entry></row>
634
d7dce7b6 635 <row><entry><option>1000basekx-full</option></entry>
6cf0a204
SS
636 <entry>1000</entry><entry>full</entry></row>
637
d7dce7b6 638 <row><entry><option>10000basekx4-full</option></entry>
6cf0a204
SS
639 <entry>10000</entry><entry>full</entry></row>
640
d7dce7b6 641 <row><entry><option>10000basekr-full</option></entry>
6cf0a204
SS
642 <entry>10000</entry><entry>full</entry></row>
643
d7dce7b6 644 <row><entry><option>10000baser-fec</option></entry>
6cf0a204
SS
645 <entry>10000</entry><entry>full</entry></row>
646
d7dce7b6 647 <row><entry><option>20000basemld2-full</option></entry>
6cf0a204
SS
648 <entry>20000</entry><entry>full</entry></row>
649
d7dce7b6 650 <row><entry><option>20000basekr2-full</option></entry>
6cf0a204
SS
651 <entry>20000</entry><entry>full</entry></row>
652 </tbody>
653 </tgroup>
654 </table>
655
656 By default this is unset, i.e. all possible modes will be advertised.
657 This option may be specified more than once, in which case all specified speeds and modes are advertised.
658 If the empty string is assigned to this option, the list is reset, and all prior assignments have no effect.
659 </para>
660 </listitem>
661 </varlistentry>
bf2334c0
YW
662 <varlistentry>
663 <term><varname>ReceiveChecksumOffload=</varname></term>
664 <listitem>
f20710c7 665 <para>Takes a boolean. If set to true, hardware offload for checksumming of ingress
bf2334c0
YW
666 network packets is enabled. When unset, the kernel's default will be used.</para>
667 </listitem>
668 </varlistentry>
669 <varlistentry>
670 <term><varname>TransmitChecksumOffload=</varname></term>
671 <listitem>
f20710c7 672 <para>Takes a boolean. If set to true, hardware offload for checksumming of egress
bf2334c0
YW
673 network packets is enabled. When unset, the kernel's default will be used.</para>
674 </listitem>
675 </varlistentry>
50725d10
SS
676 <varlistentry>
677 <term><varname>TCPSegmentationOffload=</varname></term>
678 <listitem>
f20710c7 679 <para>Takes a boolean. If set to true, TCP Segmentation Offload (TSO) is enabled.
025314d9 680 When unset, the kernel's default will be used.</para>
50725d10 681 </listitem>
ffa69a04
SS
682 </varlistentry>
683 <varlistentry>
684 <term><varname>TCP6SegmentationOffload=</varname></term>
685 <listitem>
f20710c7 686 <para>Takes a boolean. If set to true, TCP6 Segmentation Offload (tx-tcp6-segmentation) is enabled.
025314d9 687 When unset, the kernel's default will be used.</para>
ffa69a04 688 </listitem>
50725d10
SS
689 </varlistentry>
690 <varlistentry>
691 <term><varname>GenericSegmentationOffload=</varname></term>
692 <listitem>
f20710c7 693 <para>Takes a boolean. If set to true, Generic Segmentation Offload (GSO) is enabled.
025314d9 694 When unset, the kernel's default will be used.</para>
50725d10
SS
695 </listitem>
696 </varlistentry>
bf2334c0 697 <varlistentry>
f7ea90fb
SS
698 <term><varname>GenericReceiveOffload=</varname></term>
699 <listitem>
f20710c7 700 <para>Takes a boolean. If set to true, Generic Receive Offload (GRO) is enabled.
025314d9 701 When unset, the kernel's default will be used.</para>
f7ea90fb
SS
702 </listitem>
703 </varlistentry>
8f821d90
DDM
704 <varlistentry>
705 <term><varname>GenericReceiveOffloadHardware=</varname></term>
706 <listitem>
707 <para>Takes a boolean. If set to true, hardware accelerated Generic Receive Offload (GRO) is
708 enabled. When unset, the kernel's default will be used.</para>
709 </listitem>
710 </varlistentry>
f7ea90fb
SS
711 <varlistentry>
712 <term><varname>LargeReceiveOffload=</varname></term>
713 <listitem>
f20710c7 714 <para>Takes a boolean. If set to true, Large Receive Offload (LRO) is enabled.
025314d9 715 When unset, the kernel's default will be used.</para>
f7ea90fb
SS
716 </listitem>
717 </varlistentry>
5f945202
SS
718 <varlistentry>
719 <term><varname>RxChannels=</varname></term>
5f945202 720 <term><varname>TxChannels=</varname></term>
5f945202 721 <term><varname>OtherChannels=</varname></term>
5f945202
SS
722 <term><varname>CombinedChannels=</varname></term>
723 <listitem>
0d341ecc
YW
724 <para>Specifies the number of receive, transmit, other, or combined channels, respectively.
725 Takes an unsigned integer in the range 1…4294967295 or <literal>max</literal>. If set to
726 <literal>max</literal>, the advertised maximum value of the hardware will be used. When
727 unset, the number will not be changed. Defaults to unset.</para>
5f945202
SS
728 </listitem>
729 </varlistentry>
224ded67
SS
730 <varlistentry>
731 <term><varname>RxBufferSize=</varname></term>
e81f5fc4 732 <term><varname>RxMiniBufferSize=</varname></term>
e81f5fc4 733 <term><varname>RxJumboBufferSize=</varname></term>
224ded67
SS
734 <term><varname>TxBufferSize=</varname></term>
735 <listitem>
0d341ecc
YW
736 <para>Specifies the maximum number of pending packets in the NIC receive buffer, mini receive
737 buffer, jumbo receive buffer, or transmit buffer, respectively. Takes an unsigned integer in
738 the range 1…4294967295 or <literal>max</literal>. If set to <literal>max</literal>, the
739 advertised maximum value of the hardware will be used. When unset, the number will not be
740 changed. Defaults to unset.</para>
224ded67
SS
741 </listitem>
742 </varlistentry>
a34811e4
YW
743 <varlistentry>
744 <term><varname>RxFlowControl=</varname></term>
745 <listitem>
f20710c7 746 <para>Takes a boolean. When set, enables receive flow control, also known as the ethernet
a34811e4
YW
747 receive PAUSE message (generate and send ethernet PAUSE frames). When unset, the kernel's
748 default will be used.</para>
749 </listitem>
750 </varlistentry>
751 <varlistentry>
752 <term><varname>TxFlowControl=</varname></term>
753 <listitem>
f20710c7 754 <para>Takes a boolean. When set, enables transmit flow control, also known as the ethernet
a34811e4
YW
755 transmit PAUSE message (respond to received ethernet PAUSE frames). When unset, the kernel's
756 default will be used.</para>
757 </listitem>
758 </varlistentry>
759 <varlistentry>
760 <term><varname>AutoNegotiationFlowControl=</varname></term>
761 <listitem>
f20710c7 762 <para>Takes a boolean. When set, auto negotiation enables the interface to exchange state
a34811e4
YW
763 advertisements with the connected peer so that the two devices can agree on the ethernet
764 PAUSE configuration. When unset, the kernel's default will be used.</para>
765 </listitem>
766 </varlistentry>
1e270127
SS
767 <varlistentry>
768 <term><varname>GenericSegmentOffloadMaxBytes=</varname></term>
769 <listitem>
770 <para>Specifies the maximum size of a Generic Segment Offload (GSO) packet the
be0d27ee 771 device should accept. The usual suffixes K, M, G are supported and are
1d3a473b 772 understood to the base of 1024. An unsigned integer in the range 1…65536.
1e270127
SS
773 Defaults to unset.</para>
774 </listitem>
775 </varlistentry>
776 <varlistentry>
777 <term><varname>GenericSegmentOffloadMaxSegments=</varname></term>
778 <listitem>
be0d27ee
ZJS
779 <para>Specifies the maximum number of Generic Segment Offload (GSO) segments the device should
780 accept. An unsigned integer in the range 1…65535. Defaults to unset.</para>
1e270127
SS
781 </listitem>
782 </varlistentry>
6c35ea5e
DDM
783 <varlistentry>
784 <term><varname>UseAdaptiveRxCoalesce=</varname></term>
785 <term><varname>UseAdaptiveTxCoalesce=</varname></term>
786 <listitem>
787 <para>Boolean properties that, when set, enable/disable adaptive Rx/Tx coalescing if the hardware
788 supports it. When unset, the kernel's default will be used.</para>
789 </listitem>
790 </varlistentry>
791 <varlistentry>
792 <term><varname>RxCoalesceSec=</varname></term>
793 <term><varname>RxCoalesceIrqSec=</varname></term>
794 <term><varname>RxCoalesceLowSec=</varname></term>
795 <term><varname>RxCoalesceHighSec=</varname></term>
796 <term><varname>TxCoalesceSec=</varname></term>
797 <term><varname>TxCoalesceIrqSec=</varname></term>
798 <term><varname>TxCoalesceLowSec=</varname></term>
799 <term><varname>TxCoalesceHighSec=</varname></term>
800 <listitem>
801 <para>These properties configure the delay before Rx/Tx interrupts are generated after a packet is
802 sent/received. The <literal>Irq</literal> properties come into effect when the host is servicing an
803 IRQ. The <literal>Low</literal> and <literal>High</literal> properties come into effect when the
804 packet rate drops below the low packet rate threshold or exceeds the high packet rate threshold
805 respectively if adaptive Rx/Tx coalescing is enabled. When unset, the kernel's defaults will be
806 used.</para>
807 </listitem>
808 </varlistentry>
809 <varlistentry>
810 <term><varname>RxMaxCoalescedFrames=</varname></term>
811 <term><varname>RxMaxCoalescedIrqFrames=</varname></term>
812 <term><varname>RxMaxCoalescedLowFrames=</varname></term>
813 <term><varname>RxMaxCoalescedHighFrames=</varname></term>
814 <term><varname>TxMaxCoalescedFrames=</varname></term>
815 <term><varname>TxMaxCoalescedIrqFrames=</varname></term>
816 <term><varname>TxMaxCoalescedLowFrames=</varname></term>
817 <term><varname>TxMaxCoalescedHighFrames=</varname></term>
818 <listitem>
819 <para>These properties configure the maximum number of frames that are sent/received before a Rx/Tx
820 interrupt is generated. The <literal>Irq</literal> properties come into effect when the host is
821 servicing an IRQ. The <literal>Low</literal> and <literal>High</literal> properties come into
822 effect when the packet rate drops below the low packet rate threshold or exceeds the high packet
823 rate threshold respectively if adaptive Rx/Tx coalescing is enabled. When unset, the kernel's
824 defaults will be used.</para>
825 </listitem>
826 </varlistentry>
827 <varlistentry>
828 <term><varname>CoalescePacketRateLow=</varname></term>
829 <term><varname>CoalescePacketRateHigh=</varname></term>
830 <listitem>
831 <para>These properties configure the low and high packet rate (expressed in packets per second)
832 threshold respectively and are used to determine when the corresponding coalescing settings for low
833 and high packet rates come into effect if adaptive Rx/Tx coalescing is enabled. If unset, the
834 kernel's defaults will be used.</para>
835 </listitem>
836 </varlistentry>
837 <varlistentry>
838 <term><varname>CoalescePacketRateSampleIntervalSec=</varname></term>
839 <listitem>
840 <para>Configures how often to sample the packet rate used for adaptive Rx/Tx coalescing. This
841 property cannot be zero. This lowest time granularity supported by this property is seconds.
842 Partial seconds will be rounded up before being passed to the kernel. If unset, the kernel's
843 default will be used.</para>
844 </listitem>
845 </varlistentry>
846 <varlistentry>
847 <term><varname>StatisticsBlockCoalesceSec=</varname></term>
848 <listitem>
849 <para>How long to delay driver in-memory statistics block updates. If the driver does not have an
850 in-memory statistic block, this property is ignored. This property cannot be zero. If unset, the
851 kernel's default will be used.</para>
852 </listitem>
853 </varlistentry>
224ded67 854
798d3a52
ZJS
855 </variablelist>
856 </refsect1>
1ff28eae 857
798d3a52 858 <refsect1>
b97e7fab
LP
859 <title>Examples</title>
860
861 <example>
862 <title>/usr/lib/systemd/network/99-default.link</title>
863
864 <para>The link file <filename>99-default.link</filename> that is
865 shipped with systemd defines the default naming policy for
866 links.</para>
867
868 <programlisting>[Link]
869NamePolicy=kernel database onboard slot path
870MACAddressPolicy=persistent</programlisting>
871 </example>
872
873 <example>
874 <title>/etc/systemd/network/10-dmz.link</title>
875
58576937 876 <para>This example assigns the fixed name <literal>dmz0</literal> to the interface with the MAC address
b97e7fab
LP
877 00:a0:de:63:7a:e6:</para>
878
879 <programlisting>[Match]
880MACAddress=00:a0:de:63:7a:e6
881
882[Link]
883Name=dmz0</programlisting>
58576937 884
7a447d21 885 <para><varname>NamePolicy=</varname> is not set, so <varname>Name=</varname> takes effect. We use the
a19b9a38 886 <literal>10-</literal> prefix to order this file early in the list. Note that it needs to be before
7a447d21
ZJS
887 <literal>99-link</literal>, i.e. it needs a numerical prefix, to have any effect at all.</para>
888 </example>
889
890 <example>
891 <title>Debugging <varname>NamePolicy=</varname> assignments</title>
892
893 <programlisting>$ sudo SYSTEMD_LOG_LEVEL=debug udevadm test-builtin net_setup_link /sys/class/net/hub0
894
895Parsed configuration file /usr/lib/systemd/network/99-default.link
896Parsed configuration file /etc/systemd/network/10-eth0.link
897ID_NET_DRIVER=cdc_ether
898Config file /etc/systemd/network/10-eth0.link applies to device hub0
899link_config: autonegotiation is unset or enabled, the speed and duplex are not writable.
900hub0: Device has name_assign_type=4
901Using default interface naming scheme 'v240'.
902hub0: Policies didn't yield a name, using specified Name=hub0.
903ID_NET_LINK_FILE=/etc/systemd/network/10-eth0.link
904ID_NET_NAME=hub0
905…</programlisting>
906
907 <para>Explicit <varname>Name=</varname> configuration wins in this case.</para>
908
909 <programlisting>sudo SYSTEMD_LOG_LEVEL=debug udevadm test-builtin net_setup_link /sys/class/net/enp0s31f6
910
911Parsed configuration file /usr/lib/systemd/network/99-default.link
912Parsed configuration file /etc/systemd/network/10-eth0.link
913Created link configuration context.
914ID_NET_DRIVER=e1000e
915Config file /usr/lib/systemd/network/99-default.link applies to device enp0s31f6
916link_config: autonegotiation is unset or enabled, the speed and duplex are not writable.
917enp0s31f6: Device has name_assign_type=4
918Using default interface naming scheme 'v240'.
919enp0s31f6: Policy *keep*: keeping existing userspace name
920enp0s31f6: Device has addr_assign_type=0
921enp0s31f6: MAC on the device already matches policy *persistent*
922ID_NET_LINK_FILE=/usr/lib/systemd/network/99-default.link
923
924</programlisting>
925
926 <para>In this case, the interface was already renamed, so the <option>keep</option> policy specified as
b0343f8c 927 the first option in <filename index="false">99-default.link</filename> means that the existing name is
7a447d21
ZJS
928 preserved. If <option>keep</option> was removed, or if were in boot before the renaming has happened,
929 we might get the following instead:</para>
930
931 <programlisting>enp0s31f6: Policy *path* yields "enp0s31f6".
932enp0s31f6: Device has addr_assign_type=0
933enp0s31f6: MAC on the device already matches policy *persistent*
934ID_NET_LINK_FILE=/usr/lib/systemd/network/99-default.link
935ID_NET_NAME=enp0s31f6
936
937</programlisting>
938
939 <para>Please note that the details of output are subject to change.</para>
b97e7fab
LP
940 </example>
941
942 <example>
943 <title>/etc/systemd/network/10-internet.link</title>
944
945 <para>This example assigns the fixed name
946 <literal>internet0</literal> to the interface with the device
947 path <literal>pci-0000:00:1a.0-*</literal>:</para>
948
949 <programlisting>[Match]
950Path=pci-0000:00:1a.0-*
951
952[Link]
953Name=internet0</programlisting>
954 </example>
955
798d3a52 956 <example>
6c1695be 957 <title>/etc/systemd/network/25-wireless.link</title>
1ff28eae 958
b97e7fab
LP
959 <para>Here's an overly complex example that shows the use of a large number of [Match] and [Link] settings.</para>
960
798d3a52 961 <programlisting>[Match]
7abaad1a 962MACAddress=12:34:56:78:9a:bc
963Driver=brcmsmac
964Path=pci-0000:02:00.0-*
965Type=wlan
966Virtualization=no
967Host=my-laptop
968Architecture=x86-64
1ff28eae 969
7abaad1a 970[Link]
971Name=wireless0
972MTUBytes=1450
973BitsPerSecond=10M
974WakeOnLan=magic
975MACAddress=cb:a9:87:65:43:21</programlisting>
798d3a52
ZJS
976 </example>
977 </refsect1>
1ff28eae 978
798d3a52
ZJS
979 <refsect1>
980 <title>See Also</title>
981 <para>
982 <citerefentry>
983 <refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum>
984 </citerefentry>,
985 <citerefentry>
986 <refentrytitle>udevadm</refentrytitle><manvolnum>8</manvolnum>
987 </citerefentry>,
988 <citerefentry>
989 <refentrytitle>systemd.netdev</refentrytitle><manvolnum>5</manvolnum>
990 </citerefentry>,
991 <citerefentry>
992 <refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum>
993 </citerefentry>
994 </para>
995 </refsect1>
1ff28eae
TG
996
997</refentry>