Debian Codegraph @

upstream/opensuse-tumbleweed/man7/systemd.net-naming-scheme.7

raw
1 '\" t
2 .TH "SYSTEMD\&.NET\-NAMING\-SCHEME" "7" "" "systemd 260.1" "systemd.net-naming-scheme"
3 .\" -----------------------------------------------------------------
4 .\" * Define some portability stuff
5 .\" -----------------------------------------------------------------
6 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 .\" http://bugs.debian.org/507673
8 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
9 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 .ie \n(.g .ds Aq \(aq
11 .el .ds Aq '
12 .\" -----------------------------------------------------------------
13 .\" * set default formatting
14 .\" -----------------------------------------------------------------
15 .\" disable hyphenation
16 .nh
17 .\" disable justification (adjust text to left margin only)
18 .ad l
19 .\" -----------------------------------------------------------------
20 .\" * MAIN CONTENT STARTS HERE *
21 .\" -----------------------------------------------------------------
22 .SH "NAME"
23 systemd.net-naming-scheme \- Network device naming schemes
24 .SH "DESCRIPTION"
25 .PP
26 Network interfaces names and MAC addresses may be generated based on certain stable interface attributes\&. This is possible when there is enough information about the device to generate those attributes and the use of this information is configured\&. This page describes interface naming, i\&.e\&. what possible names may be generated\&. Those names are generated by the
27 \fBsystemd-udevd.service\fR(8)
28 builtin
29 \fBnet_id\fR
30 and exported as
31 \fBudev\fR(7)
32 properties (\fIID_NET_NAME_ONBOARD=\fR,
33 \fIID_NET_LABEL_ONBOARD=\fR,
34 \fIID_NET_NAME_PATH=\fR,
35 \fIID_NET_NAME_SLOT=\fR)\&.
36 .PP
37 Names and MAC addresses are derived from various stable device metadata attributes\&. Newer versions of
38 \fBsystemd\-udevd\fR
39 take more of these attributes into account, improving (and thus possibly changing) the names and addresses used for the same devices\&. Different versions of those generation rules are called "naming schemes"\&. The default naming scheme is chosen at compilation time\&. Usually this will be the latest implemented version, but it is also possible to set one of the older versions to preserve compatibility\&. This may be useful for example for distributions, which may introduce new versions of systemd in stable releases without changing the naming scheme\&. The naming scheme may also be overridden using the
40 \fInet\&.naming_scheme=\fR
41 kernel command line switch, see
42 \fBsystemd-udevd.service\fR(8)\&. Available naming schemes are described below\&.
43 .PP
44 After the udev properties have been generated, appropriate udev rules may be used to actually rename devices based on those properties\&. See the description of
45 \fINamePolicy=\fR
46 and
47 \fIMACAddressPolicy=\fR
48 in
49 \fBsystemd.link\fR(5)\&.
50 .PP
51 Note that while the concept of network interface naming schemes is primarily relevant in the context of
52 systemd\-udevd\&.service, the
53 \fBsystemd-nspawn\fR(1)
54 container manager also takes it into account when naming network interfaces, see below\&.
55 .SH "POLICIES"
56 .PP
57 All names start with a two\-character prefix that signifies the interface type\&.
58 .sp
59 .it 1 an-trap
60 .nr an-no-space-flag 1
61 .nr an-break-flag 1
62 .br
63 .B Table\ \&1.\ \&Two character prefixes based on the type of interface
64 .TS
65 allbox tab(:);
66 lB lB.
67 T{
68 Prefix
69 T}:T{
70 Description
71 T}
72 .T&
73 l l
74 l l
75 l l
76 l l
77 l l
78 l l.
79 T{
80 \fBen\fR
81 T}:T{
82 Ethernet
83 T}
84 T{
85 \fBib\fR
86 T}:T{
87 InfiniBand
88 T}
89 T{
90 \fBsl\fR
91 T}:T{
92 Serial line IP (slip)
93 T}
94 T{
95 \fBwl\fR
96 T}:T{
97 Wireless local area network (WLAN)
98 T}
99 T{
100 \fBww\fR
101 T}:T{
102 Wireless wide area network (WWAN)
103 T}
104 T{
105 \fBmc\fR
106 T}:T{
107 Management Component Transport Protocol (MCTP)
108 T}
109 .TE
110 .sp 1
111 .PP
112 The
113 \fBudev\fR(7)
114 \fBnet_id\fR
115 builtin exports the following device properties:
116 .PP
117 \fIID_NET_NAME_ONBOARD=\fR\fIprefix\fR\fBo\fR\fInumber\fR, \fIID_NET_NAME_ONBOARD=\fR\fIprefix\fR\fBd\fR\fInumber\fR
118 .RS 4
119 This name is set based on the numeric ordering information given by the firmware for on\-board devices\&. Different schemes are used depending on the firmware type, as described in the table below\&.
120 .sp
121 .it 1 an-trap
122 .nr an-no-space-flag 1
123 .nr an-break-flag 1
124 .br
125 .B Table\ \&2.\ \&On\-board naming schemes
126 .TS
127 allbox tab(:);
128 lB lB.
129 T{
130 Format
131 T}:T{
132 Description
133 T}
134 .T&
135 l l
136 l l.
137 T{
138 \fIprefix\fR\fBo\fR\fInumber\fR
139 T}:T{
140 PCI on\-board index
141 T}
142 T{
143 \fIprefix\fR\fBd\fR\fInumber\fR
144 T}:T{
145 DeviceTree alias index
146 T}
147 .TE
148 .sp 1
149 Added in version 243\&.
150 .RE
151 .PP
152 \fIID_NET_LABEL_ONBOARD=\fR\fIlabel\fR
153 .RS 4
154 This property is set based on textual label given by the firmware for on\-board devices\&. This is only available for PCI devices\&.
155 .sp
156 Added in version 243\&.
157 .RE
158 .PP
159 \fIID_NET_NAME_MAC=\fR\fIprefix\fR\fBx\fR\fIAABBCCDDEEFF\fR
160 .RS 4
161 This name consists of the prefix, letter
162 \fBx\fR, and 12 hexadecimal digits of the MAC address\&. It is available if the device has a fixed MAC address\&. Because this name is based on an attribute of the card itself, it remains "stable" when the device is moved (even between machines), but will change when the hardware is replaced\&.
163 .sp
164 Added in version 243\&.
165 .RE
166 .PP
167 \fIID_NET_NAME_SLOT=\fR\fIprefix\fR[\fBP\fR\fIdomain\fR]\fBs\fR\fIslot\fR[\fBf\fR\fIfunction\fR][\fBn\fR\fIport_name\fR|\fBd\fR\fIdev_port\fR], \fIID_NET_NAME_SLOT=\fR\fIprefix\fR\fBv\fR\fIslot\fR, \fIID_NET_NAME_SLOT=\fR\fIprefix\fR\fBx\fR\fIslot\fR, \fIID_NET_NAME_SLOT=\fR\fIprefix\fR[\fBP\fR\fIdomain\fR]\fBs\fR\fIslot\fR[\fBf\fR\fIfunction\fR][\fBn\fR\fIport_name\fR|\fBd\fR\fIdev_port\fR]\fBb\fR\fInumber\fR, \fIID_NET_NAME_SLOT=\fR\fIprefix\fR[\fBP\fR\fIdomain\fR]\fBs\fR\fIslot\fR[\fBf\fR\fIfunction\fR][\fBn\fR\fIport_name\fR|\fBd\fR\fIdev_port\fR]\fBu\fR\fIport\fR\&...[\fBc\fR\fIconfig\fR][\fBi\fR\fIinterface\fR], \fIID_NET_NAME_SLOT=\fR\fIprefix\fR[\fBP\fR\fIdomain\fR]\fBs\fR\fIslot\fR[\fBf\fR\fIfunction\fR][\fBn\fR\fIport_name\fR|\fBd\fR\fIdev_port\fR]\fBv\fR\fIslot\fR, \fIID_NET_NAME_SLOT=\fR\fIprefix\fR[\fBP\fR\fIdomain\fR]\fBs\fR\fIslot\fR[\fBf\fR\fIfunction\fR][\fBn\fR\fIport_name\fR|\fBd\fR\fIdev_port\fR]\fBr\fR\fIslot\fR
168 .RS 4
169 This property describes the slot position\&. Different schemes are used depending on the bus type, as described in the table below\&. In case of USB, BCMA, and SR\-VIO devices, the full name consists of the prefix, PCI slot identifier, and USB or BCMA or SR\-VIO slot identifier\&. The first two parts are denoted as "\&..." in the table below\&.
170 .sp
171 .it 1 an-trap
172 .nr an-no-space-flag 1
173 .nr an-break-flag 1
174 .br
175 .B Table\ \&3.\ \&Slot naming schemes
176 .TS
177 allbox tab(:);
178 lB lB.
179 T{
180 Format
181 T}:T{
182 Description
183 T}
184 .T&
185 l l
186 l l
187 l l
188 l l
189 l l
190 l l
191 l l.
192 T{
193 \fIprefix\fR\ \&[\fBP\fR\fIdomain\fR]\ \&\fBs\fR\fIslot\fR\ \&[\fBf\fR\fIfunction\fR]\ \&[\fBn\fR\fIport_name\fR\ \&|\ \&\fBd\fR\fIdev_port\fR]
194 T}:T{
195 PCI slot number
196 T}
197 T{
198 \fIprefix\fR\ \&\fBv\fR\fIslot\fR
199 T}:T{
200 VIO slot number (IBM PowerVM)
201 T}
202 T{
203 \fIprefix\fR\ \&\fBX\fR\fInumber\fR
204 T}:T{
205 VIF interface number (Xen)
206 T}
207 T{
208 \&...\ \&\fBb\fR\fInumber\fR
209 T}:T{
210 Broadcom bus (BCMA) core number
211 T}
212 T{
213 \&...\ \&\fBu\fR\fIport\fR\&...\ \&[\fBc\fR\fIconfig\fR]\ \&[\fBi\fR\fIinterface\fR]
214 T}:T{
215 USB port number chain
216 T}
217 T{
218 \&...\ \&\fBv\fR\fIslot\fR
219 T}:T{
220 SR\-VIO slot number
221 T}
222 T{
223 \&...\ \&\fBr\fR\fIslot\fR
224 T}:T{
225 SR\-IOV slot number
226 T}
227 .TE
228 .sp 1
229 The PCI domain is only prepended when it is not 0\&. All multi\-function PCI devices will carry the
230 \fBf\fR\fIfunction\fR
231 number in the device name, including the function 0 device\&. For non\-multi\-function devices, the number is suppressed if 0\&. The port name
232 \fIport_name\fR
233 is used, or the port number
234 \fBd\fR\fIdev_port\fR
235 if the name is not known\&.
236 .sp
237 For BCMA devices, the core number is suppressed when 0\&.
238 .sp
239 For USB devices the full chain of port numbers of hubs is composed\&. If the name gets longer than the maximum number of 15 characters, the name is not exported\&. The usual USB configuration number 1 and interface number 0 values are suppressed\&.
240 .sp
241 SR\-IOV virtual devices are named based on the name of the parent interface, with a suffix of
242 \fBv\fR
243 and the virtual device number, with any leading zeros removed\&. The bus number is ignored\&.
244 .sp
245 SR\-IOV virtual device representors are named based on the name of the physical device interface, with a suffix of
246 \fBr\fR
247 and the number of the virtual device that is linked to the particular representor, with any leading zeros removed\&. The physical port name and the bus number are ignored\&.
248 .sp
249 In some configurations a parent PCI bridge of a given network controller may be associated with a slot\&. In such case we do not generate this device property to avoid possible naming conflicts\&.
250 .sp
251 Added in version 243\&.
252 .RE
253 .PP
254 \fIID_NET_NAME_PATH=\fR\fIprefix\fR\fBc\fR\fIbus_id\fR, \fIID_NET_NAME_PATH=\fR\fIprefix\fR\fBa\fR\fIvendor\fR\fImodel\fR\fBi\fR\fIinstance\fR, \fIID_NET_NAME_PATH=\fR\fIprefix\fR\fBi\fR\fIaddress\fR\fBn\fR\fIport_name\fR, \fIID_NET_NAME_PATH=\fR\fIprefix\fR\fBu\fR\fIport\fR\&..., \fIID_NET_NAME_PATH=\fR\fIprefix\fR[\fBP\fR\fIdomain\fR]\fBp\fR\fIbus\fR\fBs\fR\fIslot\fR[\fBf\fR\fIfunction\fR][\fBn\fR\fIphys_port_name\fR|\fBd\fR\fIdev_port\fR], \fIID_NET_NAME_PATH=\fR\fIprefix\fR[\fBP\fR\fIdomain\fR]\fBp\fR\fIbus\fR\fBs\fR\fIslot\fR[\fBf\fR\fIfunction\fR][\fBn\fR\fIphys_port_name\fR|\fBd\fR\fIdev_port\fR]\fBb\fR\fInumber\fR, \fIID_NET_NAME_PATH=\fR\fIprefix\fR[\fBP\fR\fIdomain\fR]\fBp\fR\fIbus\fR\fBs\fR\fIslot\fR[\fBf\fR\fIfunction\fR][\fBn\fR\fIphys_port_name\fR|\fBd\fR\fIdev_port\fR]\fBu\fR\fIport\fR\&...[\fBc\fR\fIconfig\fR][\fBi\fR\fIinterface\fR]
255 .RS 4
256 This property describes the device installation location\&. Different schemes are used depending on the bus type, as described in the table below\&. For BCMA and USB devices, PCI path information must known, and the full name consists of the prefix, PCI slot identifier, and USB or BCMA location\&. The first two parts are denoted as "\&..." in the table below\&.
257 .sp
258 .it 1 an-trap
259 .nr an-no-space-flag 1
260 .nr an-break-flag 1
261 .br
262 .B Table\ \&4.\ \&Path naming schemes
263 .TS
264 allbox tab(:);
265 lB lB.
266 T{
267 Format
268 T}:T{
269 Description
270 T}
271 .T&
272 l l
273 l l
274 l l
275 l l
276 l l
277 l l.
278 T{
279 \fIprefix\fR\ \&\fBc\fR\fIbus_id\fR
280 T}:T{
281 CCW or grouped CCW device identifier
282 T}
283 T{
284 \fIprefix\fR\ \&\fBa\fR\fIvendor\fR\ \&\fImodel\fR\ \&\fBi\fR\fIinstance\fR
285 T}:T{
286 ACPI path names for ARM64 platform devices
287 T}
288 T{
289 \fIprefix\fR\ \&\fBi\fR\fIaddress\fR\ \&\fBn\fR\fIport_name\fR
290 T}:T{
291 Netdevsim (simulated networking device) device number and port name
292 T}
293 T{
294 \fIprefix\fR\ \&[\fBP\fR\fIdomain\fR]\ \&\fBp\fR\fIbus\fR\ \&\fBs\fR\fIslot\fR\ \&[\fBf\fR\fIfunction\fR]\ \&[\fBn\fR\fIphys_port_name\fR\ \&|\ \&\fBd\fR\fIdev_port\fR]
295 T}:T{
296 PCI geographical location
297 T}
298 T{
299 \&...\ \&\fBb\fR\fInumber\fR
300 T}:T{
301 Broadcom bus (BCMA) core number
302 T}
303 T{
304 \&...\ \&\fBu\fR\fIport\fR\&...\ \&[\fBc\fR\fIconfig\fR]\ \&[\fBi\fR\fIinterface\fR]
305 T}:T{
306 USB port number chain
307 T}
308 .TE
309 .sp 1
310 CCW and grouped CCW devices are found in IBM System Z mainframes\&. Any leading zeros and dots are suppressed\&.
311 .sp
312 For PCI, BCMA, and USB devices, the same rules as described above for slot naming are used\&.
313 .sp
314 Added in version 243\&.
315 .RE
316 .SH "HISTORY"
317 .PP
318 The following "naming schemes" have been defined (which may be chosen at system boot\-up time via the
319 \fInet\&.naming_scheme=\fR
320 kernel command line switch, see above):
321 .PP
322 \fBv238\fR
323 .RS 4
324 This is the naming scheme that was implemented in systemd 238\&.
325 .sp
326 Added in version 243\&.
327 .RE
328 .PP
329 \fBv239\fR
330 .RS 4
331 Naming was changed for virtual network interfaces created with SR\-IOV and NPAR and for devices where the PCI network controller device does not have a slot number associated\&.
332 .sp
333 SR\-IOV virtual devices are named based on the name of the parent interface, with a suffix of
334 "v\fIport\fR", where
335 \fIport\fR
336 is the virtual device number\&. Previously those virtual devices were named as if completely independent\&.
337 .sp
338 The ninth and later NPAR virtual devices are named following the scheme used for the first eight NPAR partitions\&. Previously those devices were not renamed and the kernel default ("eth\fIN\fR") was used\&.
339 .sp
340 Names are also generated for PCI devices where the PCI network controller device does not have an associated slot number itself, but one of its parents does\&. Previously those devices were not renamed and the kernel default was used\&.
341 .sp
342 Added in version 243\&.
343 .RE
344 .PP
345 \fBv240\fR
346 .RS 4
347 The
348 "ib"
349 prefix and stable names for infiniband devices are introduced\&. Previously those devices were not renamed\&.
350 .sp
351 The ACPI index field (used in
352 \fIID_NET_NAME_ONBOARD=\fR) is now also used when 0\&.
353 .sp
354 A new naming policy
355 \fINamePolicy=keep\fR
356 was introduced\&. With this policy, if the network device name was already set by userspace, the device will not be renamed again\&. Previously, this naming policy applied implicitly, and now it must be explicitly requested\&. Effectively, this means that network devices will be renamed according to the configuration, even if they have been renamed already, if
357 \fBkeep\fR
358 is not specified as the naming policy in the
359 \&.link
360 file\&. See
361 \fBsystemd.link\fR(5)
362 for a description of
363 \fINamePolicy=\fR\&.
364 .sp
365 Added in version 243\&.
366 .RE
367 .PP
368 \fBv241\fR
369 .RS 4
370 \fBMACAddressPolicy=persistent\fR
371 was extended to set MAC addresses based on the device name\&. Previously addresses were only based on the
372 \fIID_NET_NAME_*\fR
373 attributes, which meant that interface names would never be generated for virtual devices\&. Now a persistent address will be generated for most devices, including in particular bridges\&.
374 .sp
375 Note: when userspace does not set a MAC address for a bridge device, the kernel will initially assign a random address, and then change it when the first device is enslaved to the bridge\&. With this naming policy change, bridges get a persistent MAC address based on the bridge name instead of the first enslaved device\&.
376 .sp
377 Added in version 243\&.
378 .RE
379 .PP
380 \fBv243\fR
381 .RS 4
382 Support for renaming netdevsim (simulated networking) devices was added\&. Previously those devices were not renamed\&.
383 .sp
384 Previously two\-letter interface type prefix was prepended to
385 \fIID_NET_LABEL_ONBOARD=\fR\&. This is not done anymore\&.
386 .sp
387 Added in version 243\&.
388 .RE
389 .PP
390 \fBv245\fR
391 .RS 4
392 When
393 \fBsystemd-nspawn\fR(1)
394 derives the name for the host side of the network interface created with
395 \fB\-\-network\-veth\fR
396 from the container name it previously simply truncated the result at 15 characters if longer (since that\*(Aqs the maximum length for network interface names)\&. From now on, for any interface name that would be longer than 15 characters the last 4 characters are set to a 24bit hash value of the full interface name\&. This way network interface name collisions between multiple similarly named containers (who only differ in container name suffix) should be less likely (but still possible, since the 24bit hash value is very small)\&.
397 .sp
398 Added in version 245\&.
399 .RE
400 .PP
401 \fBv247\fR
402 .RS 4
403 When a PCI slot is associated with a PCI bridge that has multiple child network controllers, the same value of the
404 \fIID_NET_NAME_SLOT\fR
405 property might be derived for those controllers\&. This would cause a naming conflict if the property is selected as the device name\&. Now, we detect this situation and do not produce the
406 \fIID_NET_NAME_SLOT\fR
407 property\&.
408 .sp
409 Added in version 247\&.
410 .RE
411 .PP
412 \fBv249\fR
413 .RS 4
414 PCI hotplug slot names for the s390 PCI driver are a hexadecimal representation of the
415 function_id
416 device attribute\&. This attribute is now used to build the
417 \fIID_NET_NAME_SLOT\fR\&. Before that, all slot names were parsed as decimal numbers, which could either result in an incorrect value of the
418 \fIID_NET_NAME_SLOT\fR
419 property or none at all\&.
420 .sp
421 Some firmware and hypervisor implementations report unreasonably high numbers for the on\-board index\&. To prevent the generation of bogus on\-board interface names, index numbers greater than 16381 (2\(S1⁴\-1) were ignored\&. For s390 PCI devices index values up to 65535 (2\(S1⁶\-1) are valid\&. To account for that, the limit was increased to 65535\&.
422 .sp
423 The
424 \fBudev\fR(7)
425 rule
426 \fINAME=\fR
427 replaces
428 ":",
429 "/", and
430 "%"
431 with an underscore ("_"), and refuses strings which contain only digits\&.
432 .sp
433 Added in version 249\&.
434 .RE
435 .PP
436 \fBv250\fR
437 .RS 4
438 Added naming scheme for Xen netfront "vif" interfaces based on the guest side VIF number set from the Xen config (or the interface index in AWS EC2)\&.
439 .sp
440 Added in version 250\&.
441 .RE
442 .PP
443 \fBv251\fR
444 .RS 4
445 Since version
446 \fBv247\fR
447 we no longer set
448 \fIID_NET_NAME_SLOT\fR
449 if we detect that a PCI device associated with a slot is a PCI bridge as that would create naming conflict when there are more child devices on that bridge\&. Now, this is relaxed and we will use slot information to generate the name based on it but only if the PCI device has multiple functions\&. This is safe because distinct function number is a part of the device name for multifunction devices\&. Note, this is reverted in
450 \fBv255\fR\&. See below\&.
451 .sp
452 Added in version 251\&.
453 .RE
454 .PP
455 \fBv252\fR
456 .RS 4
457 Added naming scheme for platform devices with devicetree aliases\&.
458 .sp
459 Added in version 252\&.
460 .RE
461 .PP
462 \fBv253\fR
463 .RS 4
464 Set
465 \fIID_NET_NAME_PATH\fR
466 for usb devices not connected via a PCI bus\&.
467 .sp
468 Added in version 253\&.
469 .RE
470 .PP
471 \fBv254\fR
472 .RS 4
473 Naming was changed for SR\-IOV virtual device representors, optionally settable at compilation time\&. The
474 "r\fIslot\fR"
475 suffix was added to differentiate SR\-IOV virtual device representors attached to a single physical device interface\&. Because of a mistake, this scheme was
476 \fInot the default scheme for systemd version 254\fR\&.
477 .sp
478 Added in version 255\&.
479 .RE
480 .PP
481 \fBv255\fR
482 .RS 4
483 Naming was changed for SR\-IOV virtual device representors to enable the change introduced in
484 \fBv254\fR
485 by default\&.
486 .sp
487 If we detect that a PCI device associated with a slot is a PCI bridge, we no longer set
488 \fIID_NET_NAME_SLOT\fR, reverting a change that was introduced in
489 \fBv251\fR\&.
490 .sp
491 Added in version 255\&.
492 .RE
493 .PP
494 \fBv257\fR
495 .RS 4
496 PCI slot number is now read from
497 \fBfirmware_node/sun\fR
498 sysfs file\&.
499 .sp
500 The naming scheme based on devicetree aliases was extended to support aliases for individual interfaces of controllers with multiple ports\&.
501 .sp
502 Added in version 257\&.
503 .RE
504 .PP
505 \fBv258\fR
506 .RS 4
507 When no renaming is requested,
508 \fIID_NET_NAME\fR
509 property is now equivalent to
510 \fIINTERFACE\fR
511 property\&.
512 .sp
513 Added in version 258\&.
514 .RE
515 .PP
516 \fBv259\fR
517 .RS 4
518 The naming scheme based on devicetree aliases was extended to support WLAN devices\&.
519 .sp
520 Added in version 259\&.
521 .RE
522 .PP
523 \fBv260\fR
524 .RS 4
525 MCTP interfaces are now assigned persistent names, using a
526 \fBmc\fR
527 prefix\&.
528 .sp
529 Added in version 260\&.
530 .RE
531 .PP
532 Note that
533 \fBlatest\fR
534 may be used to denote the latest scheme known (to this particular version of systemd)\&.
535 .SH "LIMITING THE USE OF SPECIFIC SYSFS ATTRIBUTES"
536 .PP
537 When creating names for network cards, some naming schemes use data from sysfs populated by the kernel\&. This means that although a specific naming scheme in
538 \fBudev\fR(7)
539 is picked, the network card\*(Aqs name can still change when a new kernel version adds a new sysfs attribute\&. For example, if kernel starts setting the
540 \fBphys_port_name\fR,
541 \fBudev\fR
542 will append the "\fBn\fR\fIphys_port_name\fR" suffix to the device name\&.
543 .PP
544 \fIID_NET_NAME_ALLOW=\fR\fIBOOL\fR
545 .RS 4
546 This udev property sets a fallback policy for reading a sysfs attribute\&. If set to
547 \fB0\fR
548 udev will not read any sysfs attribute by default, unless it is explicitly allowlisted, see below\&. If set to
549 \fB1\fR
550 udev can use any sysfs attribute unless it is explicitly forbidden\&. The default value is
551 \fB1\fR\&.
552 .sp
553 Added in version 256\&.
554 .RE
555 .PP
556 \fIID_NET_NAME_ALLOW_\fR\fI\fIsysfsattr\fR\fR\fI=\fR\fI\fIBOOL\fR\fR
557 .RS 4
558 This udev property explicitly states if udev shall use the specified
559 \fIsysfsattr\fR, when composing the device name\&.
560 .sp
561 Added in version 256\&.
562 .RE
563 .PP
564 With these options, users can set an allowlist or denylist for sysfs attributes\&. To create an allowlist, the user needs to set
565 \fIID_NET_NAME_ALLOW=0\fR
566 for the device and then list the allowed attributes with the
567 \fIID_NET_NAME_ALLOW_\fR\fI\fIsysfsattr\fR\fR\fI=1\fR
568 options\&. In case of a denylist, the user needs to provide the list of denied attributes with the
569 \fIID_NET_NAME_ALLOW_\fR\fI\fIsysfsattr\fR\fR\fI=0\fR
570 options\&.
571 .SH "EXAMPLES"
572 .PP
573 \fBExample\ \&1.\ \&Using udevadm test\-builtin to display device properties\fR
574 .sp
575 .if n \{\
576 .RS 4
577 .\}
578 .nf
579 $ udevadm test\-builtin net_id /sys/class/net/enp0s31f6
580 \&.\&.\&.
581 Using default interface naming scheme \*(Aqv243\*(Aq\&.
582 ID_NET_NAMING_SCHEME=v243
583 ID_NET_NAME_MAC=enx54ee75cb1dc0
584 ID_OUI_FROM_DATABASE=Wistron InfoComm(Kunshan)Co\&.,Ltd\&.
585 ID_NET_NAME_PATH=enp0s31f6
586 \&.\&.\&.
587 .fi
588 .if n \{\
589 .RE
590 .\}
591 .PP
592 \fBExample\ \&2.\ \&PCI Ethernet card with firmware index "1"\fR
593 .sp
594 .if n \{\
595 .RS 4
596 .\}
597 .nf
598 ID_NET_NAME_ONBOARD=eno1
599 ID_NET_NAME_ONBOARD_LABEL=Ethernet Port 1
600 .fi
601 .if n \{\
602 .RE
603 .\}
604 .PP
605 \fBExample\ \&3.\ \&PCI Ethernet card in slot with firmware index number\fR
606 .sp
607 .if n \{\
608 .RS 4
609 .\}
610 .nf
611 # /sys/devices/pci0000:00/0000:00:1c\&.3/0000:05:00\&.0/net/ens1
612 ID_NET_NAME_MAC=enx000000000466
613 ID_NET_NAME_PATH=enp5s0
614 ID_NET_NAME_SLOT=ens1
615 .fi
616 .if n \{\
617 .RE
618 .\}
619 .PP
620 \fBExample\ \&4.\ \&PCI Ethernet multi\-function card with 2 ports\fR
621 .sp
622 .if n \{\
623 .RS 4
624 .\}
625 .nf
626 # /sys/devices/pci0000:00/0000:00:1c\&.0/0000:02:00\&.0/net/enp2s0f0
627 ID_NET_NAME_MAC=enx78e7d1ea46da
628 ID_NET_NAME_PATH=enp2s0f0
629
630 # /sys/devices/pci0000:00/0000:00:1c\&.0/0000:02:00\&.1/net/enp2s0f1
631 ID_NET_NAME_MAC=enx78e7d1ea46dc
632 ID_NET_NAME_PATH=enp2s0f1
633 .fi
634 .if n \{\
635 .RE
636 .\}
637 .PP
638 \fBExample\ \&5.\ \&PCI WLAN card\fR
639 .sp
640 .if n \{\
641 .RS 4
642 .\}
643 .nf
644 # /sys/devices/pci0000:00/0000:00:1c\&.1/0000:03:00\&.0/net/wlp3s0
645 ID_NET_NAME_MAC=wlx0024d7e31130
646 ID_NET_NAME_PATH=wlp3s0
647 .fi
648 .if n \{\
649 .RE
650 .\}
651 .PP
652 \fBExample\ \&6.\ \&PCI IB host adapter with 2 ports\fR
653 .sp
654 .if n \{\
655 .RS 4
656 .\}
657 .nf
658 # /sys/devices/pci0000:00/0000:00:03\&.0/0000:15:00\&.0/net/ibp21s0f0
659 ID_NET_NAME_PATH=ibp21s0f0
660
661 # /sys/devices/pci0000:00/0000:00:03\&.0/0000:15:00\&.1/net/ibp21s0f1
662 ID_NET_NAME_PATH=ibp21s0f1
663 .fi
664 .if n \{\
665 .RE
666 .\}
667 .PP
668 \fBExample\ \&7.\ \&USB built\-in 3G modem\fR
669 .sp
670 .if n \{\
671 .RS 4
672 .\}
673 .nf
674 # /sys/devices/pci0000:00/0000:00:1d\&.0/usb2/2\-1/2\-1\&.4/2\-1\&.4:1\&.6/net/wwp0s29u1u4i6
675 ID_NET_NAME_MAC=wwx028037ec0200
676 ID_NET_NAME_PATH=wwp0s29u1u4i6
677 .fi
678 .if n \{\
679 .RE
680 .\}
681 .PP
682 \fBExample\ \&8.\ \&USB Android phone\fR
683 .sp
684 .if n \{\
685 .RS 4
686 .\}
687 .nf
688 # /sys/devices/pci0000:00/0000:00:1d\&.0/usb2/2\-1/2\-1\&.2/2\-1\&.2:1\&.0/net/enp0s29u1u2
689 ID_NET_NAME_MAC=enxd626b3450fb5
690 ID_NET_NAME_PATH=enp0s29u1u2
691 .fi
692 .if n \{\
693 .RE
694 .\}
695 .PP
696 \fBExample\ \&9.\ \&s390 grouped CCW interface\fR
697 .sp
698 .if n \{\
699 .RS 4
700 .\}
701 .nf
702 # /sys/devices/css0/0\&.0\&.0007/0\&.0\&.f5f0/group_device/net/encf5f0
703 ID_NET_NAME_MAC=enx026d3c00000a
704 ID_NET_NAME_PATH=encf5f0
705 .fi
706 .if n \{\
707 .RE
708 .\}
709 .PP
710 \fBExample\ \&10.\ \&Set an allowlist for reading sysfs attributes for network card naming\fR
711 .sp
712 .if n \{\
713 .RS 4
714 .\}
715 .nf
716 /etc/udev/hwdb\&.d/50\-net\-naming\-allowlist\&.hwdb
717 net:naming:drvirtio_net:*
718 ID_NET_NAME_ALLOW=0
719 ID_NET_NAME_ALLOW_ACPI_INDEX=1
720 ID_NET_NAME_ALLOW_ADDR_ASSIGN_TYPE=1
721 ID_NET_NAME_ALLOW_ADDRESS=1
722 ID_NET_NAME_ALLOW_ARI_ENABLED=1
723 ID_NET_NAME_ALLOW_DEV_PORT=1
724 ID_NET_NAME_ALLOW_FUNCTION_ID=1
725 ID_NET_NAME_ALLOW_IFLINK=1
726 ID_NET_NAME_ALLOW_INDEX=1
727 ID_NET_NAME_ALLOW_LABEL=1
728 ID_NET_NAME_ALLOW_PHYS_PORT_NAME=1
729 ID_NET_NAME_ALLOW_TYPE=1
730 .fi
731 .if n \{\
732 .RE
733 .\}
734 .PP
735 \fBExample\ \&11.\ \&Set a denylist so that specified sysfs attribute are ignored\fR
736 .sp
737 .if n \{\
738 .RS 4
739 .\}
740 .nf
741 /etc/udev/hwdb\&.d/50\-net\-naming\-denylist\&.hwdb
742 net:naming:drvirtio_net:*
743 ID_NET_NAME_ALLOW=1
744 ID_NET_NAME_ALLOW_DEV_PORT=0
745 ID_NET_NAME_ALLOW_PHYS_PORT_NAME=0
746 .fi
747 .if n \{\
748 .RE
749 .\}
750 .SH "SEE ALSO"
751 .PP
752 \fBudev\fR(7), \fBudevadm\fR(8), \fBsystemd-udevd.service\fR(8), \m[blue]\fBPredictable Network Interface Names\fR\m[]\&\s-2\u[1]\d\s+2, \fBsystemd-nspawn\fR(1)
753 .SH "NOTES"
754 .IP " 1." 4
755 Predictable Network Interface Names
756 .RS 4
757 \%https://systemd.io/PREDICTABLE_INTERFACE_NAMES
758 .RE