Debian Codegraph @

man/systemd.net-naming-scheme.xml

raw
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.5/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
5
6 <refentry id="systemd.net-naming-scheme" xmlns:xi="http://www.w3.org/2001/XInclude">
7 <refentryinfo>
8 <title>systemd.net-naming-scheme</title>
9 <productname>systemd</productname>
10 </refentryinfo>
11
12 <refmeta>
13 <refentrytitle>systemd.net-naming-scheme</refentrytitle>
14 <manvolnum>7</manvolnum>
15 </refmeta>
16
17 <refnamediv>
18 <refname>systemd.net-naming-scheme</refname>
19 <refpurpose>Network device naming schemes</refpurpose>
20 </refnamediv>
21
22 <refsect1>
23 <title>Description</title>
24
25 <para>Network interfaces names and MAC addresses may be generated based on certain stable interface
26 attributes. This is possible when there is enough information about the device to generate those
27 attributes and the use of this information is configured. This page describes interface naming, i.e. what
28 possible names may be generated. Those names are generated by the
29 <citerefentry><refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
30 builtin <command>net_id</command> and exported as
31 <citerefentry><refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum></citerefentry>
32 properties (<varname>ID_NET_NAME_ONBOARD=</varname>, <varname>ID_NET_LABEL_ONBOARD=</varname>,
33 <varname>ID_NET_NAME_PATH=</varname>, <varname>ID_NET_NAME_SLOT=</varname>).</para>
34
35 <para>Names and MAC addresses are derived from various stable device metadata attributes. Newer versions
36 of <command>systemd-udevd</command> take more of these attributes into account, improving (and thus
37 possibly changing) the names and addresses used for the same devices. Different versions of those
38 generation rules are called "naming schemes". The default naming scheme is chosen at compilation time.
39 Usually this will be the latest implemented version, but it is also possible to set one of the older
40 versions to preserve compatibility. This may be useful for example for distributions, which may introduce
41 new versions of systemd in stable releases without changing the naming scheme. The naming scheme may also
42 be overridden using the <varname>net.naming_scheme=</varname> kernel command line switch, see
43 <citerefentry><refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
44 Available naming schemes are described below.</para>
45
46 <para>After the udev properties have been generated, appropriate udev rules may be used to actually rename
47 devices based on those properties. See the description of <varname>NamePolicy=</varname> and
48 <varname>MACAddressPolicy=</varname> in
49 <citerefentry><refentrytitle>systemd.link</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
50
51 <para>Note that while the concept of network interface naming schemes is primarily relevant in the
52 context of <filename>systemd-udevd.service</filename>, the
53 <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry>
54 container manager also takes it into account when naming network interfaces, see below.</para>
55 </refsect1>
56
57 <refsect1>
58 <title>Policies</title>
59
60 <para>All names start with a two-character prefix that signifies the interface type.</para>
61
62 <table>
63 <title>Two character prefixes based on the type of interface</title>
64
65 <tgroup cols='2'>
66 <thead>
67 <row>
68 <entry>Prefix</entry>
69 <entry>Description</entry>
70 </row>
71 </thead>
72 <tbody>
73 <row>
74 <entry><constant>en</constant></entry>
75 <entry>Ethernet</entry>
76 </row>
77 <row>
78 <entry><constant>ib</constant></entry>
79 <entry>InfiniBand</entry>
80 </row>
81 <row>
82 <entry><constant>sl</constant></entry>
83 <entry>Serial line IP (slip)</entry>
84 </row>
85 <row>
86 <entry><constant>wl</constant></entry>
87 <entry>Wireless local area network (WLAN)</entry>
88 </row>
89 <row>
90 <entry><constant>ww</constant></entry>
91 <entry>Wireless wide area network (WWAN)</entry>
92 </row>
93 <row>
94 <entry><constant>mc</constant></entry>
95 <entry>Management Component Transport Protocol (MCTP)</entry>
96 </row>
97 </tbody>
98 </tgroup>
99 </table>
100
101 <para>The <citerefentry><refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum></citerefentry>
102 <command>net_id</command> builtin exports the following device properties:</para>
103
104 <variablelist>
105 <varlistentry>
106 <term><varname>ID_NET_NAME_ONBOARD=</varname><replaceable>prefix</replaceable><constant>o</constant><replaceable>number</replaceable></term>
107 <term><varname>ID_NET_NAME_ONBOARD=</varname><replaceable>prefix</replaceable><constant>d</constant><replaceable>number</replaceable></term>
108
109 <listitem><para>This name is set based on the numeric ordering information given by the firmware
110 for on-board devices. Different schemes are used depending on the firmware type, as described in
111 the table below.</para>
112
113 <table>
114 <title>On-board naming schemes</title>
115
116 <tgroup cols='2'>
117 <thead>
118 <row>
119 <entry>Format</entry>
120 <entry>Description</entry>
121 </row>
122 </thead>
123
124 <tbody>
125 <row>
126 <entry><replaceable>prefix</replaceable><constant>o</constant><replaceable>number</replaceable></entry>
127 <entry>PCI on-board index</entry>
128 </row>
129
130 <row>
131 <entry><replaceable>prefix</replaceable><constant>d</constant><replaceable>number</replaceable></entry>
132 <entry>DeviceTree alias index</entry>
133 </row>
134
135 </tbody>
136 </tgroup>
137 </table>
138
139 <xi:include href="version-info.xml" xpointer="v243"/>
140 </listitem>
141 </varlistentry>
142
143 <varlistentry>
144 <term><varname>ID_NET_LABEL_ONBOARD=</varname><replaceable>label</replaceable></term>
145
146 <listitem><para>This property is set based on textual label given by the firmware for on-board
147 devices. This is only available for PCI devices.</para>
148
149 <xi:include href="version-info.xml" xpointer="v243"/>
150 </listitem>
151 </varlistentry>
152
153 <varlistentry>
154 <term><varname>ID_NET_NAME_MAC=</varname><replaceable>prefix</replaceable><constant>x</constant><replaceable>AABBCCDDEEFF</replaceable></term>
155
156 <listitem><para>This name consists of the prefix, letter <constant>x</constant>, and 12 hexadecimal
157 digits of the MAC address. It is available if the device has a fixed MAC address. Because this name
158 is based on an attribute of the card itself, it remains "stable" when the device is moved (even
159 between machines), but will change when the hardware is replaced.</para>
160
161 <xi:include href="version-info.xml" xpointer="v243"/>
162 </listitem>
163 </varlistentry>
164
165 <varlistentry>
166 <term><varname>ID_NET_NAME_SLOT=</varname><replaceable>prefix</replaceable>[<constant>P</constant><replaceable>domain</replaceable>]<constant>s</constant><replaceable>slot</replaceable>[<constant>f</constant><replaceable>function</replaceable>][<constant>n</constant><replaceable>port_name</replaceable>|<constant>d</constant><replaceable>dev_port</replaceable>]</term>
167 <term><varname>ID_NET_NAME_SLOT=</varname><replaceable>prefix</replaceable><constant>v</constant><replaceable>slot</replaceable></term>
168 <term><varname>ID_NET_NAME_SLOT=</varname><replaceable>prefix</replaceable><constant>x</constant><replaceable>slot</replaceable></term>
169 <term><varname>ID_NET_NAME_SLOT=</varname><replaceable>prefix</replaceable>[<constant>P</constant><replaceable>domain</replaceable>]<constant>s</constant><replaceable>slot</replaceable>[<constant>f</constant><replaceable>function</replaceable>][<constant>n</constant><replaceable>port_name</replaceable>|<constant>d</constant><replaceable>dev_port</replaceable>]<constant>b</constant><replaceable>number</replaceable></term>
170 <term><varname>ID_NET_NAME_SLOT=</varname><replaceable>prefix</replaceable>[<constant>P</constant><replaceable>domain</replaceable>]<constant>s</constant><replaceable>slot</replaceable>[<constant>f</constant><replaceable>function</replaceable>][<constant>n</constant><replaceable>port_name</replaceable>|<constant>d</constant><replaceable>dev_port</replaceable>]<constant>u</constant><replaceable>port</replaceable>…[<constant>c</constant><replaceable>config</replaceable>][<constant>i</constant><replaceable>interface</replaceable>]</term>
171 <term><varname>ID_NET_NAME_SLOT=</varname><replaceable>prefix</replaceable>[<constant>P</constant><replaceable>domain</replaceable>]<constant>s</constant><replaceable>slot</replaceable>[<constant>f</constant><replaceable>function</replaceable>][<constant>n</constant><replaceable>port_name</replaceable>|<constant>d</constant><replaceable>dev_port</replaceable>]<constant>v</constant><replaceable>slot</replaceable></term>
172 <term><varname>ID_NET_NAME_SLOT=</varname><replaceable>prefix</replaceable>[<constant>P</constant><replaceable>domain</replaceable>]<constant>s</constant><replaceable>slot</replaceable>[<constant>f</constant><replaceable>function</replaceable>][<constant>n</constant><replaceable>port_name</replaceable>|<constant>d</constant><replaceable>dev_port</replaceable>]<constant>r</constant><replaceable>slot</replaceable></term>
173 <term><varname>ID_NET_NAME_SLOT=</varname><replaceable>prefix</replaceable>[<constant>P</constant><replaceable>domain</replaceable>]<constant>s</constant><replaceable>slot</replaceable>[<constant>f</constant><replaceable>function</replaceable>][<constant>n</constant><replaceable>port_name</replaceable>|<constant>d</constant><replaceable>dev_port</replaceable>]<constant>S</constant><replaceable>sfnum</replaceable></term>
174
175 <listitem><para>This property describes the slot position. Different schemes are used depending on
176 the bus type, as described in the table below. In case of USB, BCMA, and SR-VIO devices, the full
177 name consists of the prefix, PCI slot identifier, and USB or BCMA or SR-VIO slot identifier. The
178 first two parts are denoted as "…" in the table below.</para>
179
180 <table>
181 <title>Slot naming schemes</title>
182
183 <tgroup cols='2'>
184 <thead>
185 <row>
186 <entry>Format</entry>
187 <entry>Description</entry>
188 </row>
189 </thead>
190
191 <tbody>
192 <row>
193 <entry><replaceable>prefix</replaceable> [<constant>P</constant><replaceable>domain</replaceable>] <constant>s</constant><replaceable>slot</replaceable> [<constant>f</constant><replaceable>function</replaceable>] [<constant>n</constant><replaceable>port_name</replaceable> | <constant>d</constant><replaceable>dev_port</replaceable>]</entry>
194 <entry>PCI slot number</entry>
195 </row>
196
197 <row>
198 <entry><replaceable>prefix</replaceable> <constant>v</constant><replaceable>slot</replaceable></entry>
199 <entry>VIO slot number (IBM PowerVM)</entry>
200 </row>
201
202 <row>
203 <entry><replaceable>prefix</replaceable> <constant>X</constant><replaceable>number</replaceable></entry>
204 <entry>VIF interface number (Xen)</entry>
205 </row>
206
207 <row>
208 <entry>… <constant>b</constant><replaceable>number</replaceable></entry>
209 <entry>Broadcom bus (BCMA) core number</entry>
210 </row>
211
212 <row>
213 <entry>… <constant>u</constant><replaceable>port</replaceable>… [<constant>c</constant><replaceable>config</replaceable>] [<constant>i</constant><replaceable>interface</replaceable>]</entry>
214 <entry>USB port number chain</entry>
215 </row>
216
217 <row>
218 <entry>… <constant>v</constant><replaceable>slot</replaceable></entry>
219 <entry>SR-VIO slot number</entry>
220 </row>
221
222 <row>
223 <entry>… <constant>r</constant><replaceable>slot</replaceable></entry>
224 <entry>SR-IOV slot number</entry>
225 </row>
226
227 <row>
228 <entry>… <constant>S</constant><replaceable>sfnum</replaceable></entry>
229 <entry>Auxiliary sub-function (SF) number</entry>
230 </row>
231 </tbody>
232 </tgroup>
233 </table>
234
235 <para>The PCI domain is only prepended when it is not 0. All multi-function PCI devices will carry
236 the <constant>f</constant><replaceable>function</replaceable> number in the device name, including
237 the function 0 device. For non-multi-function devices, the number is suppressed if 0. The port name
238 <replaceable>port_name</replaceable> is used, or the port number
239 <constant>d</constant><replaceable>dev_port</replaceable> if the name is not known.</para>
240
241 <para>For BCMA devices, the core number is suppressed when 0.</para>
242
243 <para>For USB devices the full chain of port numbers of hubs is composed. If the name gets longer
244 than the maximum number of 15 characters, the name is not exported. The usual USB configuration
245 number 1 and interface number 0 values are suppressed.</para>
246
247 <para>SR-IOV virtual devices are named based on the name of the parent interface, with a suffix of
248 <constant>v</constant> and the virtual device number, with any leading zeros removed. The bus
249 number is ignored.</para>
250
251 <para>SR-IOV virtual device representors are named based on the name of the physical device
252 interface, with a suffix of <constant>r</constant> and the number of the virtual device that
253 is linked to the particular representor, with any leading zeros removed. The physical port
254 name and the bus number are ignored.</para>
255
256 <para>Auxiliary sub-function (SF) network devices, where the network device's parent is an
257 auxiliary device exposing a <constant>sfnum</constant> sysfs attribute (currently mlx5_core SFs),
258 are named based on the underlying PCI function (the PF, or for VF-SF the PF behind the VF),
259 with a suffix of <constant>S</constant> and the user-defined sub-function number from
260 <constant>sfnum</constant>. This is analogous to how SR-IOV virtual function devices are named
261 with a <constant>v</constant> suffix.</para>
262
263 <para>If the SF's parent PCI function is itself an SR-IOV virtual function (VF-SF), the
264 name is rooted at the PF and both suffixes are chained, with the <constant>v</constant>
265 suffix preceding the <constant>S</constant> suffix
266 (e.g. <literal>enp193s0f0v0S88</literal>). The PF, the VF, and the SF therefore form a
267 stable, hierarchical sequence regardless of the VF's underlying PCI bus/device/function
268 numbering.</para>
269
270 <para>In some configurations a parent PCI bridge of a given network controller may be associated
271 with a slot. In such case we do not generate this device property to avoid possible naming conflicts.</para>
272
273 <xi:include href="version-info.xml" xpointer="v243"/>
274 </listitem>
275 </varlistentry>
276
277 <varlistentry>
278 <term><varname>ID_NET_NAME_PATH=</varname><replaceable>prefix</replaceable><constant>c</constant><replaceable>bus_id</replaceable></term>
279 <term><varname>ID_NET_NAME_PATH=</varname><replaceable>prefix</replaceable><constant>a</constant><replaceable>vendor</replaceable><replaceable>model</replaceable><constant>i</constant><replaceable>instance</replaceable></term>
280 <term><varname>ID_NET_NAME_PATH=</varname><replaceable>prefix</replaceable><constant>i</constant><replaceable>address</replaceable><constant>n</constant><replaceable>port_name</replaceable></term>
281 <term><varname>ID_NET_NAME_PATH=</varname><replaceable>prefix</replaceable><constant>u</constant><replaceable>port</replaceable>…</term>
282 <term><varname>ID_NET_NAME_PATH=</varname><replaceable>prefix</replaceable>[<constant>P</constant><replaceable>domain</replaceable>]<constant>p</constant><replaceable>bus</replaceable><constant>s</constant><replaceable>slot</replaceable>[<constant>f</constant><replaceable>function</replaceable>][<constant>n</constant><replaceable>phys_port_name</replaceable>|<constant>d</constant><replaceable>dev_port</replaceable>]</term>
283 <term><varname>ID_NET_NAME_PATH=</varname><replaceable>prefix</replaceable>[<constant>P</constant><replaceable>domain</replaceable>]<constant>p</constant><replaceable>bus</replaceable><constant>s</constant><replaceable>slot</replaceable>[<constant>f</constant><replaceable>function</replaceable>][<constant>n</constant><replaceable>phys_port_name</replaceable>|<constant>d</constant><replaceable>dev_port</replaceable>]<constant>b</constant><replaceable>number</replaceable></term>
284 <term><varname>ID_NET_NAME_PATH=</varname><replaceable>prefix</replaceable>[<constant>P</constant><replaceable>domain</replaceable>]<constant>p</constant><replaceable>bus</replaceable><constant>s</constant><replaceable>slot</replaceable>[<constant>f</constant><replaceable>function</replaceable>][<constant>n</constant><replaceable>phys_port_name</replaceable>|<constant>d</constant><replaceable>dev_port</replaceable>]<constant>u</constant><replaceable>port</replaceable>…[<constant>c</constant><replaceable>config</replaceable>][<constant>i</constant><replaceable>interface</replaceable>]</term>
285 <term><varname>ID_NET_NAME_PATH=</varname><replaceable>prefix</replaceable>[<constant>P</constant><replaceable>domain</replaceable>]<constant>p</constant><replaceable>bus</replaceable><constant>s</constant><replaceable>slot</replaceable>[<constant>f</constant><replaceable>function</replaceable>][<constant>n</constant><replaceable>phys_port_name</replaceable>|<constant>d</constant><replaceable>dev_port</replaceable>]<constant>S</constant><replaceable>sfnum</replaceable></term>
286
287 <listitem><para>This property describes the device installation location. Different schemes are
288 used depending on the bus type, as described in the table below. For BCMA and USB devices, PCI path
289 information must known, and the full name consists of the prefix, PCI slot identifier, and USB or
290 BCMA location. The first two parts are denoted as "…" in the table below.</para>
291
292 <table>
293 <title>Path naming schemes</title>
294
295 <tgroup cols='2'>
296 <thead>
297 <row>
298 <entry>Format</entry>
299 <entry>Description</entry>
300 </row>
301 </thead>
302
303 <tbody>
304 <row>
305 <entry><replaceable>prefix</replaceable> <constant>c</constant><replaceable>bus_id</replaceable></entry>
306 <entry>CCW or grouped CCW device identifier</entry>
307 </row>
308
309 <row>
310 <entry><replaceable>prefix</replaceable> <constant>a</constant><replaceable>vendor</replaceable> <replaceable>model</replaceable> <constant>i</constant><replaceable>instance</replaceable></entry>
311 <entry>ACPI path names for ARM64 platform devices</entry>
312 </row>
313
314 <row>
315 <entry><replaceable>prefix</replaceable> <constant>i</constant><replaceable>address</replaceable> <constant>n</constant><replaceable>port_name</replaceable></entry>
316 <entry>Netdevsim (simulated networking device) device number and port name</entry>
317 </row>
318
319 <row>
320 <entry><replaceable>prefix</replaceable> [<constant>P</constant><replaceable>domain</replaceable>] <constant>p</constant><replaceable>bus</replaceable> <constant>s</constant><replaceable>slot</replaceable> [<constant>f</constant><replaceable>function</replaceable>] [<constant>n</constant><replaceable>phys_port_name</replaceable> | <constant>d</constant><replaceable>dev_port</replaceable>]</entry>
321 <entry>PCI geographical location</entry>
322 </row>
323
324 <row>
325 <entry>… <constant>b</constant><replaceable>number</replaceable></entry>
326 <entry>Broadcom bus (BCMA) core number</entry>
327 </row>
328
329 <row>
330 <entry>… <constant>u</constant><replaceable>port</replaceable>… [<constant>c</constant><replaceable>config</replaceable>] [<constant>i</constant><replaceable>interface</replaceable>]</entry>
331 <entry>USB port number chain</entry>
332 </row>
333
334 <row>
335 <entry>… <constant>S</constant><replaceable>sfnum</replaceable></entry>
336 <entry>Auxiliary sub-function (SF) number</entry>
337 </row>
338
339 </tbody>
340 </tgroup>
341 </table>
342
343 <para>CCW and grouped CCW devices are found in IBM System Z mainframes. Any leading zeros and
344 dots are suppressed.</para>
345
346 <para>For PCI, BCMA, and USB devices, the same rules as described above for slot naming are
347 used.</para>
348
349 <xi:include href="version-info.xml" xpointer="v243"/>
350 </listitem>
351 </varlistentry>
352 </variablelist>
353 </refsect1>
354
355 <refsect1>
356 <title>History</title>
357
358 <para>The following "naming schemes" have been defined (which may be chosen at system boot-up time via
359 the <varname>net.naming_scheme=</varname> kernel command line switch, see above):</para>
360
361 <variablelist>
362 <varlistentry>
363 <term><constant>v238</constant></term>
364
365 <listitem><para>This is the naming scheme that was implemented in systemd 238.</para>
366
367 <xi:include href="version-info.xml" xpointer="v243"/></listitem>
368 </varlistentry>
369
370 <varlistentry>
371 <term><constant>v239</constant></term>
372
373 <listitem><para>Naming was changed for virtual network interfaces created with SR-IOV and NPAR and
374 for devices where the PCI network controller device does not have a slot number associated.</para>
375
376 <para>SR-IOV virtual devices are named based on the name of the parent interface, with a suffix of
377 <literal>v<replaceable>port</replaceable></literal>, where <replaceable>port</replaceable> is the
378 virtual device number. Previously those virtual devices were named as if completely independent.
379 </para>
380
381 <para>The ninth and later NPAR virtual devices are named following the scheme used for the first
382 eight NPAR partitions. Previously those devices were not renamed and the kernel default
383 ("eth<replaceable>N</replaceable>") was used.</para>
384
385 <para>Names are also generated for PCI devices where the PCI network controller device does not
386 have an associated slot number itself, but one of its parents does. Previously those devices were
387 not renamed and the kernel default was used.</para>
388
389 <xi:include href="version-info.xml" xpointer="v243"/>
390 </listitem>
391 </varlistentry>
392
393 <varlistentry>
394 <term><constant>v240</constant></term>
395
396 <listitem><para>The <literal>ib</literal> prefix and stable names for infiniband devices are
397 introduced. Previously those devices were not renamed.</para>
398
399 <para>The ACPI index field (used in <varname>ID_NET_NAME_ONBOARD=</varname>) is now also used when
400 0.</para>
401
402 <para>A new naming policy <varname>NamePolicy=keep</varname> was introduced. With this policy, if
403 the network device name was already set by userspace, the device will not be renamed
404 again. Previously, this naming policy applied implicitly, and now it must be explicitly
405 requested. Effectively, this means that network devices will be renamed according to the
406 configuration, even if they have been renamed already, if <constant>keep</constant> is not
407 specified as the naming policy in the <filename index="false">.link</filename> file. See
408 <citerefentry><refentrytitle>systemd.link</refentrytitle><manvolnum>5</manvolnum></citerefentry>
409 for a description of <varname>NamePolicy=</varname>.</para>
410
411 <xi:include href="version-info.xml" xpointer="v243"/></listitem>
412 </varlistentry>
413
414 <varlistentry>
415 <term><constant>v241</constant></term>
416
417 <listitem><para><option>MACAddressPolicy=persistent</option> was extended to set MAC addresses
418 based on the device name. Previously addresses were only based on the
419 <varname index="false">ID_NET_NAME_*</varname> attributes, which meant that interface names would
420 never be generated for virtual devices. Now a persistent address will be generated for most
421 devices, including in particular bridges.</para>
422
423 <para>Note: when userspace does not set a MAC address for a bridge device, the kernel will
424 initially assign a random address, and then change it when the first device is enslaved to the
425 bridge. With this naming policy change, bridges get a persistent MAC address based on the bridge
426 name instead of the first enslaved device.</para>
427
428 <xi:include href="version-info.xml" xpointer="v243"/></listitem>
429 </varlistentry>
430
431 <varlistentry>
432 <term><constant>v243</constant></term>
433
434 <listitem><para>Support for renaming netdevsim (simulated networking) devices was added. Previously
435 those devices were not renamed.</para>
436
437 <para>Previously two-letter interface type prefix was prepended to
438 <varname>ID_NET_LABEL_ONBOARD=</varname>. This is not done anymore.</para>
439
440 <xi:include href="version-info.xml" xpointer="v243"/></listitem>
441 </varlistentry>
442
443 <varlistentry>
444 <term><constant>v245</constant></term>
445
446 <listitem><para>When
447 <citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry>
448 derives the name for the host side of the network interface created with
449 <option>--network-veth</option> from the container name it previously simply truncated the result
450 at 15 characters if longer (since that's the maximum length for network interface names). From now
451 on, for any interface name that would be longer than 15 characters the last 4 characters are set to
452 a 24bit hash value of the full interface name. This way network interface name collisions between
453 multiple similarly named containers (who only differ in container name suffix) should be less
454 likely (but still possible, since the 24bit hash value is very small).</para>
455
456 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
457 </varlistentry>
458
459 <varlistentry>
460 <term><constant>v247</constant></term>
461
462 <listitem><para>When a PCI slot is associated with a PCI bridge that has multiple child network
463 controllers, the same value of the <varname>ID_NET_NAME_SLOT</varname> property might be derived
464 for those controllers. This would cause a naming conflict if the property is selected as the device
465 name. Now, we detect this situation and do not produce the <varname>ID_NET_NAME_SLOT</varname>
466 property.</para>
467
468 <xi:include href="version-info.xml" xpointer="v247"/></listitem>
469 </varlistentry>
470
471 <varlistentry>
472 <term><constant>v249</constant></term>
473
474 <listitem><para>PCI hotplug slot names for the s390 PCI driver are a hexadecimal representation
475 of the <filename>function_id</filename> device attribute. This attribute is now used to build the
476 <varname>ID_NET_NAME_SLOT</varname>. Before that, all slot names were parsed as decimal
477 numbers, which could either result in an incorrect value of the <varname>ID_NET_NAME_SLOT</varname>
478 property or none at all.</para>
479
480 <para>Some firmware and hypervisor implementations report unreasonably high numbers for the
481 on-board index. To prevent the generation of bogus on-board interface names, index numbers greater
482 than 16381 (2¹⁴-1) were ignored. For s390 PCI devices index values up to 65535 (2¹⁶-1) are valid.
483 To account for that, the limit was increased to 65535.</para>
484
485 <para>The <citerefentry><refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum></citerefentry>
486 rule <varname>NAME=</varname> replaces <literal>:</literal>, <literal>/</literal>, and
487 <literal>%</literal> with an underscore (<literal>_</literal>), and refuses strings which contain
488 only digits.</para>
489
490 <xi:include href="version-info.xml" xpointer="v249"/>
491 </listitem>
492 </varlistentry>
493
494 <varlistentry>
495 <term><constant>v250</constant></term>
496
497 <listitem><para>Added naming scheme for Xen netfront "vif" interfaces based on the guest side
498 VIF number set from the Xen config (or the interface index in AWS EC2).</para>
499
500 <xi:include href="version-info.xml" xpointer="v250"/>
501 </listitem>
502 </varlistentry>
503
504 <varlistentry>
505 <term><constant>v251</constant></term>
506
507 <listitem><para>Since version <constant>v247</constant> we no longer set
508 <varname>ID_NET_NAME_SLOT</varname> if we detect that a PCI device associated with a slot is a PCI
509 bridge as that would create naming conflict when there are more child devices on that bridge. Now,
510 this is relaxed and we will use slot information to generate the name based on it but only if
511 the PCI device has multiple functions. This is safe because distinct function number is a part of
512 the device name for multifunction devices. Note, this is reverted in <constant>v255</constant>.
513 See below.</para>
514
515 <xi:include href="version-info.xml" xpointer="v251"/>
516 </listitem>
517 </varlistentry>
518
519 <varlistentry>
520 <term><constant>v252</constant></term>
521
522 <listitem><para>Added naming scheme for platform devices with devicetree aliases.</para>
523
524 <xi:include href="version-info.xml" xpointer="v252"/>
525 </listitem>
526 </varlistentry>
527
528 <varlistentry>
529 <term><constant>v253</constant></term>
530
531 <listitem><para>Set <varname>ID_NET_NAME_PATH</varname> for usb devices not connected via a PCI bus.</para>
532
533 <xi:include href="version-info.xml" xpointer="v253"/>
534 </listitem>
535 </varlistentry>
536
537 <varlistentry>
538 <term><constant>v254</constant></term>
539
540 <listitem><para>Naming was changed for SR-IOV virtual device representors, optionally settable at
541 compilation time. The <literal>r<replaceable>slot</replaceable></literal> suffix was added to
542 differentiate SR-IOV virtual device representors attached to a single physical device interface.
543 Because of a mistake, this scheme was <emphasis>not the default scheme for systemd version
544 254</emphasis>.</para>
545
546 <xi:include href="version-info.xml" xpointer="v255"/>
547 </listitem>
548 </varlistentry>
549
550 <varlistentry>
551 <term><constant>v255</constant></term>
552
553 <listitem><para>Naming was changed for SR-IOV virtual device representors to enable the
554 change introduced in <constant>v254</constant> by default.</para>
555
556 <para>If we detect that a PCI device associated with a slot is a PCI bridge, we no longer set
557 <varname>ID_NET_NAME_SLOT</varname>, reverting a change that was introduced in
558 <constant>v251</constant>.</para>
559
560 <xi:include href="version-info.xml" xpointer="v255"/>
561 </listitem>
562 </varlistentry>
563
564 <varlistentry>
565 <term><constant>v257</constant></term>
566
567 <listitem><para>PCI slot number is now read from <constant>firmware_node/sun</constant> sysfs file.</para>
568
569 <para>The naming scheme based on devicetree aliases was extended to support aliases for individual
570 interfaces of controllers with multiple ports.</para>
571
572 <xi:include href="version-info.xml" xpointer="v257"/>
573 </listitem>
574 </varlistentry>
575
576 <varlistentry>
577 <term><constant>v258</constant></term>
578
579 <listitem><para>When no renaming is requested, <varname>ID_NET_NAME</varname> property is now
580 equivalent to <varname>INTERFACE</varname> property.</para>
581
582 <xi:include href="version-info.xml" xpointer="v258"/>
583 </listitem>
584 </varlistentry>
585
586 <varlistentry>
587 <term><constant>v259</constant></term>
588
589 <listitem><para>The naming scheme based on devicetree aliases was extended to support WLAN devices.</para>
590
591 <xi:include href="version-info.xml" xpointer="v259"/>
592 </listitem>
593 </varlistentry>
594
595 <varlistentry>
596 <term><constant>v260</constant></term>
597
598 <listitem><para>MCTP interfaces are now assigned persistent names, using a <constant>mc</constant>
599 prefix.</para>
600
601 <xi:include href="version-info.xml" xpointer="v260"/>
602 </listitem>
603 </varlistentry>
604
605 <varlistentry>
606 <term><constant>v261</constant></term>
607
608 <listitem><para>Stable names are now generated for auxiliary sub-function (SF) network devices
609 (such as <literal>mlx5_core</literal> SFs). The name is built from the parent PCI Physical Function's
610 path with an <literal>S<replaceable>sfnum</replaceable></literal> suffix, where
611 <replaceable>sfnum</replaceable> is the user-defined SF number (the value passed to
612 <command>devlink port add … sfnum <replaceable>N</replaceable></command>, exposed by the kernel as
613 the <constant>sfnum</constant> sysfs attribute on the auxiliary device). This is analogous to the
614 <literal>v<replaceable>N</replaceable></literal> suffix used for SR-IOV virtual functions; for SFs
615 hosted on SR-IOV VFs (VF-SF), the two suffixes are chained on top of the PF's base name.</para>
616
617 <xi:include href="version-info.xml" xpointer="v261"/>
618 </listitem>
619 </varlistentry>
620 </variablelist>
621
622 <para>Note that <constant>latest</constant> may be used to denote the latest scheme known (to this
623 particular version of systemd).</para>
624 </refsect1>
625
626 <refsect1>
627 <title>Limiting the use of specific sysfs attributes</title>
628
629 <para>When creating names for network cards, some naming schemes use data from sysfs populated by the
630 kernel. This means that although a specific naming scheme in
631 <citerefentry><refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum></citerefentry> is picked, the
632 network card's name can still change when a new kernel version adds a new sysfs attribute. For example,
633 if kernel starts setting the <constant>phys_port_name</constant>, <command>udev</command> will append the
634 "<constant>n</constant><replaceable>phys_port_name</replaceable>" suffix to the device name.</para>
635
636 <variablelist>
637 <varlistentry>
638 <term><varname>ID_NET_NAME_ALLOW=</varname><replaceable>BOOL</replaceable></term>
639
640 <listitem><para>This udev property sets a fallback policy for reading a sysfs attribute.
641 If set to <constant>0</constant> udev will not read any sysfs attribute by default, unless it is
642 explicitly allowlisted, see below. If set to <constant>1</constant> udev can use any sysfs attribute
643 unless it is explicitly forbidden. The default value is <constant>1</constant>.</para>
644
645 <xi:include href="version-info.xml" xpointer="v256"/>
646 </listitem>
647 </varlistentry>
648
649 <varlistentry>
650 <term><varname>ID_NET_NAME_ALLOW_<replaceable>sysfsattr</replaceable>=<replaceable>BOOL</replaceable></varname></term>
651
652 <listitem><para>This udev property explicitly states if udev shall use the specified
653 <replaceable>sysfsattr</replaceable>, when composing the device name.</para>
654
655 <xi:include href="version-info.xml" xpointer="v256"/>
656 </listitem>
657 </varlistentry>
658 </variablelist>
659
660 <para>With these options, users can set an allowlist or denylist for sysfs attributes. To create
661 an allowlist, the user needs to set <varname>ID_NET_NAME_ALLOW=0</varname> for the device and then list
662 the allowed attributes with the
663 <varname>ID_NET_NAME_ALLOW_<replaceable>sysfsattr</replaceable>=1</varname>
664 options. In case of a denylist, the user needs to provide the list of denied attributes with
665 the <varname>ID_NET_NAME_ALLOW_<replaceable>sysfsattr</replaceable>=0</varname> options.</para>
666 </refsect1>
667
668 <refsect1>
669 <title>Examples</title>
670
671 <example>
672 <title>Using <command>udevadm test-builtin</command> to display device properties</title>
673
674 <programlisting>$ udevadm test-builtin net_id /sys/class/net/enp0s31f6
675 ...
676 Using default interface naming scheme 'v243'.
677 ID_NET_NAMING_SCHEME=v243
678 ID_NET_NAME_MAC=enx54ee75cb1dc0
679 ID_OUI_FROM_DATABASE=Wistron InfoComm(Kunshan)Co.,Ltd.
680 ID_NET_NAME_PATH=enp0s31f6
681 ...</programlisting>
682 </example>
683
684 <example>
685 <title>PCI Ethernet card with firmware index "1"</title>
686
687 <programlisting>ID_NET_NAME_ONBOARD=eno1
688 ID_NET_NAME_ONBOARD_LABEL=Ethernet Port 1
689 </programlisting>
690 </example>
691
692 <example>
693 <title>PCI Ethernet card in slot with firmware index number</title>
694
695 <programlisting># /sys/devices/pci0000:00/0000:00:1c.3/0000:05:00.0/net/ens1
696 ID_NET_NAME_MAC=enx000000000466
697 ID_NET_NAME_PATH=enp5s0
698 ID_NET_NAME_SLOT=ens1</programlisting>
699 </example>
700
701 <example>
702 <title>PCI Ethernet multi-function card with 2 ports</title>
703
704 <programlisting># /sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/enp2s0f0
705 ID_NET_NAME_MAC=enx78e7d1ea46da
706 ID_NET_NAME_PATH=enp2s0f0
707
708 # /sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.1/net/enp2s0f1
709 ID_NET_NAME_MAC=enx78e7d1ea46dc
710 ID_NET_NAME_PATH=enp2s0f1</programlisting>
711 </example>
712
713 <example>
714 <title>PCI WLAN card</title>
715
716 <programlisting># /sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlp3s0
717 ID_NET_NAME_MAC=wlx0024d7e31130
718 ID_NET_NAME_PATH=wlp3s0</programlisting>
719 </example>
720
721 <example>
722 <title>PCI IB host adapter with 2 ports</title>
723
724 <programlisting># /sys/devices/pci0000:00/0000:00:03.0/0000:15:00.0/net/ibp21s0f0
725 ID_NET_NAME_PATH=ibp21s0f0
726
727 # /sys/devices/pci0000:00/0000:00:03.0/0000:15:00.1/net/ibp21s0f1
728 ID_NET_NAME_PATH=ibp21s0f1</programlisting>
729 </example>
730
731 <example>
732 <title>USB built-in 3G modem</title>
733
734 <programlisting># /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.4/2-1.4:1.6/net/wwp0s29u1u4i6
735 ID_NET_NAME_MAC=wwx028037ec0200
736 ID_NET_NAME_PATH=wwp0s29u1u4i6</programlisting>
737 </example>
738
739 <example>
740 <title>USB Android phone</title>
741
742 <programlisting># /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/net/enp0s29u1u2
743 ID_NET_NAME_MAC=enxd626b3450fb5
744 ID_NET_NAME_PATH=enp0s29u1u2</programlisting>
745 </example>
746
747 <example>
748 <title>s390 grouped CCW interface</title>
749
750 <programlisting># /sys/devices/css0/0.0.0007/0.0.f5f0/group_device/net/encf5f0
751 ID_NET_NAME_MAC=enx026d3c00000a
752 ID_NET_NAME_PATH=encf5f0</programlisting>
753 </example>
754
755 <example>
756 <title>Set an allowlist for reading sysfs attributes for network card naming</title>
757
758 <programlisting><filename>/etc/udev/hwdb.d/50-net-naming-allowlist.hwdb</filename>
759 net:naming:drvirtio_net:*
760 ID_NET_NAME_ALLOW=0
761 ID_NET_NAME_ALLOW_ACPI_INDEX=1
762 ID_NET_NAME_ALLOW_ADDR_ASSIGN_TYPE=1
763 ID_NET_NAME_ALLOW_ADDRESS=1
764 ID_NET_NAME_ALLOW_ARI_ENABLED=1
765 ID_NET_NAME_ALLOW_DEV_PORT=1
766 ID_NET_NAME_ALLOW_FUNCTION_ID=1
767 ID_NET_NAME_ALLOW_IFLINK=1
768 ID_NET_NAME_ALLOW_INDEX=1
769 ID_NET_NAME_ALLOW_LABEL=1
770 ID_NET_NAME_ALLOW_PHYS_PORT_NAME=1
771 ID_NET_NAME_ALLOW_TYPE=1</programlisting>
772 </example>
773
774 <example>
775 <title>Set a denylist so that specified sysfs attribute are ignored</title>
776
777 <programlisting><filename>/etc/udev/hwdb.d/50-net-naming-denylist.hwdb</filename>
778 net:naming:drvirtio_net:*
779 ID_NET_NAME_ALLOW=1
780 ID_NET_NAME_ALLOW_DEV_PORT=0
781 ID_NET_NAME_ALLOW_PHYS_PORT_NAME=0
782 </programlisting>
783 </example>
784 </refsect1>
785
786 <refsect1>
787 <title>See Also</title>
788 <para><simplelist type="inline">
789 <member><citerefentry><refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum></citerefentry></member>
790 <member><citerefentry><refentrytitle>udevadm</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
791 <member><citerefentry><refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
792 <member><ulink url="https://systemd.io/PREDICTABLE_INTERFACE_NAMES">Predictable Network Interface Names</ulink></member>
793 <member><citerefentry><refentrytitle>systemd-nspawn</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
794 </simplelist></para>
795 </refsect1>
796
797 </refentry>