1SYSTEMD.NET-NAMING-SCHEME(7)systemd.net-naming-schemSeYSTEMD.NET-NAMING-SCHEME(7)
2
3
4

NAME

6       systemd.net-naming-scheme - Network device naming schemes
7

DESCRIPTION

9       Network interfaces names and MAC addresses may be generated based on
10       certain stable interface attributes. This is possible when there is
11       enough information about the device to generate those attributes and
12       the use of this information is configured. This page describes
13       interface naming, i.e. what possible names may be generated. Those
14       names are generated by the systemd-udevd.service(8) builtin net_id and
15       exported as udev properties (ID_NET_NAME_ONBOARD=,
16       ID_NET_LABEL_ONBOARD=, ID_NET_NAME_PATH=, ID_NET_NAME_SLOT=).
17
18       Names and MAC addresses are derived from various stable device metadata
19       attributes. Newer versions of udev take more of these attributes into
20       account, improving (and thus possibly changing) the names and addresses
21       used for the same devices. Different versions of those generation rules
22       are called "naming schemes". The default naming scheme is chosen at
23       compilation time. Usually this will be the latest implemented version,
24       but it is also possible to set one of the older versions to preserve
25       compatibility. This may be useful for example for distributions, which
26       may introduce new versions of systemd in stable releases without
27       changing the naming scheme. The naming scheme may also be overridden
28       using the net.naming-scheme= kernel command line switch, see systemd-
29       udevd.service(8). Available naming schemes are described below.
30
31       After the udev properties have been generated, appropriate udev rules
32       may be used to actually rename devices based on those properties. See
33       the description of NamePolicy= and MACAddressPolicy= in
34       systemd.link(5).
35
36       Note that while the concept of network interface naming schemes is
37       primarily relevant in the context of systemd-udevd.service, the
38       systemd-nspawn(1) container manager also takes it into account when
39       naming network interfaces, see below.
40

NAMING

42       All names start with a two-character prefix that signifies the
43       interface type.
44
45       Table 1. Two character prefixes based on the type of interface
46       ┌───────┬────────────────────────────┐
47Prefix Description                
48       ├───────┼────────────────────────────┤
49en     │ Ethernet                   │
50       ├───────┼────────────────────────────┤
51ib     │ InfiniBand                 │
52       ├───────┼────────────────────────────┤
53sl     │ Serial line IP (slip)      │
54       ├───────┼────────────────────────────┤
55wl     │ Wireless local area        │
56       │       │ network (WLAN)             │
57       ├───────┼────────────────────────────┤
58ww     │ Wireless wide area network │
59       │       │ (WWAN)                     │
60       └───────┴────────────────────────────┘
61
62       The udev net_id builtin exports the following udev device properties:
63
64       ID_NET_NAME_ONBOARD=prefixonumber
65           This name is set based on the numeric ordering information given by
66           the firmware for on-board devices. The name consists of the prefix,
67           letter o, and a number specified by the firmware. This is only
68           available for PCI devices.
69
70       ID_NET_LABEL_ONBOARD=prefix label
71           This property is set based on textual label given by the firmware
72           for on-board devices. The name consists of the prefix concatenated
73           with the label. This is only available for PCI devices.
74
75       ID_NET_NAME_MAC=prefixxAABBCCDDEEFF
76           This name consists of the prefix, letter x, and 12 hexadecimal
77           digits of the MAC address. It is available if the device has a
78           fixed MAC address. Because this name is based on an attribute of
79           the card itself, it remains "stable" when the device is moved (even
80           between machines), but will change when the hardware is replaced.
81
82       ID_NET_NAME_SLOT=prefix[Pdomain]sslot[ffunction][nport_name|ddev_port],
83       ID_NET_NAME_SLOT=prefixvslot,
84       ID_NET_NAME_SLOT=prefix[Pdomain]sslot[ffunction][nport_name|ddev_port]bnumber,
85       ID_NET_NAME_SLOT=prefix[Pdomain]sslot[ffunction][nport_name|ddev_port]uport...[cconfig][iinterface],
86       ID_NET_NAME_SLOT=prefix[Pdomain]sslot[ffunction][nport_name|ddev_port]vslot
87           This property describes the slot position. Different schemes are
88           used depending on the bus type, as described in the table below. In
89           case of USB, BCMA, and SR-VIO devices, the full name consists of
90           the prefix, PCI slot identifier, and USB or BCMA or SR-VIO slot
91           identifier. The first two parts are denoted as "..." in the table
92           below.
93
94           Table 2. Slot naming schemes
95           ┌────────────────────────────────────────────────────────────┬──────────────────────────┐
96Format                                                      Description              
97           ├────────────────────────────────────────────────────────────┼──────────────────────────┤
98prefix [Pdomain] sslot [ffunction] [nport_name | ddev_port] │ PCI slot number          │
99           ├────────────────────────────────────────────────────────────┼──────────────────────────┤
100prefix vslot                                                │ VIO slot number (IBM     │
101           │                                                            │ PowerVM)                 │
102           ├────────────────────────────────────────────────────────────┼──────────────────────────┤
103           │... bnumber                                                 │ Broadcom bus (BCMA) core │
104           │                                                            │ number                   │
105           ├────────────────────────────────────────────────────────────┼──────────────────────────┤
106           │... uport... [cconfig] [iinterface]                         │ USB port number chain    │
107           ├────────────────────────────────────────────────────────────┼──────────────────────────┤
108           │... vslot                                                   │ SR-VIO slot number       │
109           └────────────────────────────────────────────────────────────┴──────────────────────────┘
110           The PCI domain is only prepended when it is not 0. All
111           multi-function PCI devices will carry the ffunction number in the
112           device name, including the function 0 device. For
113           non-multi-function devices, the number is suppressed if 0. The port
114           name port_name is used, or the port number ddev_port if the name is
115           not known.
116
117           For BCMA devices, the core number is suppressed when 0.
118
119           For USB devices the full chain of port numbers of hubs is composed.
120           If the name gets longer than the maximum number of 15 characters,
121           the name is not exported. The usual USB configuration number 1 and
122           interface number 0 values are suppressed.
123
124           SR-IOV virtual devices are named based on the name of the parent
125           interface, with a suffix of v and the virtual device number, with
126           any leading zeros removed. The bus number is ignored.
127
128           In some configurations a parent PCI bridge of a given network
129           controller may be associated with a slot. In such case we don't
130           generate this device property to avoid possible naming conflicts.
131
132       ID_NET_NAME_PATH=prefixcbus_id,
133       ID_NET_NAME_PATH=prefixavendormodeliinstance,
134       ID_NET_NAME_PATH=prefixiaddressnport_name,
135       ID_NET_NAME_PATH=prefix[Pdomain]pbussslot[ffunction][nphys_port_name|ddev_port],
136       ID_NET_NAME_PATH=prefix[Pdomain]pbussslot[ffunction][nphys_port_name|ddev_port]bnumber,
137       ID_NET_NAME_PATH=prefix[Pdomain]pbussslot[ffunction][nphys_port_name|ddev_port]uport...[cconfig][iinterface]
138           This property describes the device installation location. Different
139           schemes are used depending on the bus type, as described in the
140           table below. For BCMA and USB devices, PCI path information must
141           known, and the full name consists of the prefix, PCI slot
142           identifier, and USB or BCMA location. The first two parts are
143           denoted as "..." in the table below.
144
145           Table 3. Path naming schemes
146           ┌──────────────────────────────────────────────────────────────────────┬───────────────────────────┐
147Format                                                                Description               
148           ├──────────────────────────────────────────────────────────────────────┼───────────────────────────┤
149prefix cbus_id                                                        │ CCW or grouped CCW device │
150           │                                                                      │ identifier                │
151           ├──────────────────────────────────────────────────────────────────────┼───────────────────────────┤
152prefix avendor model iinstance                                        │ ACPI path names for ARM64 │
153           │                                                                      │ platform devices          │
154           ├──────────────────────────────────────────────────────────────────────┼───────────────────────────┤
155prefix iaddress nport_name                                            │ Netdevsim (simulated      │
156           │                                                                      │ networking device) device │
157           │                                                                      │ number and port name      │
158           ├──────────────────────────────────────────────────────────────────────┼───────────────────────────┤
159prefix [Pdomain] pbus sslot [ffunction] [nphys_port_name | ddev_port] │ PCI geographical location │
160           ├──────────────────────────────────────────────────────────────────────┼───────────────────────────┤
161           │... bnumber                                                           │ Broadcom bus (BCMA) core  │
162           │                                                                      │ number                    │
163           ├──────────────────────────────────────────────────────────────────────┼───────────────────────────┤
164           │... uport... [cconfig] [iinterface]                                   │ USB port number chain     │
165           └──────────────────────────────────────────────────────────────────────┴───────────────────────────┘
166           CCW and grouped CCW devices are found in IBM System Z mainframes.
167           Any leading zeros and dots are suppressed.
168
169           For PCI, BCMA, and USB devices, the same rules as described above
170           for slot naming are used.
171

HISTORY

173       The following "naming schemes" have been defined (which may be chosen
174       at system boot-up time via the net.naming-scheme= kernel command line
175       switch, see above):
176
177       v238
178           This is the naming scheme that was implemented in systemd 238.
179
180       v239
181           Naming was changed for virtual network interfaces created with
182           SR-IOV and NPAR and for devices where the PCI network controller
183           device does not have a slot number associated.
184
185           SR-IOV virtual devices are named based on the name of the parent
186           interface, with a suffix of "vport", where port is the virtual
187           device number. Previously those virtual devices were named as if
188           completely independent.
189
190           The ninth and later NPAR virtual devices are named following the
191           scheme used for the first eight NPAR partitions. Previously those
192           devices were not renamed and the kernel default ("ethN") was used.
193
194           Names are also generated for PCI devices where the PCI network
195           controller device does not have an associated slot number itself,
196           but one of its parents does. Previously those devices were not
197           renamed and the kernel default was used.
198
199       v240
200           The "ib" prefix and stable names for infiniband devices are
201           introduced. Previously those devices were not renamed.
202
203           The ACPI index field (used in ID_NET_NAME_ONBOARD=) is now also
204           used when 0.
205
206           A new naming policy NamePolicy=keep was introduced. With this
207           policy, if the network device name was already set by userspace,
208           the device will not be renamed again. Previously, this naming
209           policy applied implicitly, and now it must be explicitly requested.
210           Effectively, this means that network devices will be renamed
211           according to the configuration, even if they have been renamed
212           already, if keep is not specified as the naming policy in the .link
213           file. See systemd.link(5) for a description of NamePolicy=.
214
215       v241
216           MACAddressPolicy=persistent was extended to set MAC addresses based
217           on the device name. Previously addresses were only based on the
218           ID_NET_NAME_* attributes, which meant that interface names would
219           never be generated for virtual devices. Now a persistent address
220           will be generated for most devices, including in particular
221           bridges.
222
223           Note: when userspace does not set a MAC address for a bridge
224           device, the kernel will initially assign a random address, and then
225           change it when the first device is enslaved to the bridge. With
226           this naming policy change, bridges get a persistent MAC address
227           based on the bridge name instead of the first enslaved device.
228
229       v243
230           Support for renaming netdevsim (simulated networking) devices was
231           added. Previously those devices were not renamed.
232
233           Previously two-letter interface type prefix was prepended to
234           ID_NET_LABEL_ONBOARD=. This is not done anymore.
235
236       v245
237           When systemd-nspawn(1) derives the name for the host side of the
238           network interface created with --network-veth from the container
239           name it previously simply truncated the result at 15 characters if
240           longer (since that's the maximum length for network interface
241           names). From now on, for any interface name that would be longer
242           than 15 characters the last 4 characters are set to a 24bit hash
243           value of the full interface name. This way network interface name
244           collisions between multiple similarly named containers (who only
245           differ in container name suffix) should be less likely (but still
246           possible, since the 24bit hash value is very small).
247
248       v247
249           When a PCI slot is associated with a PCI bridge that has multiple
250           child network controllers, the same value of the ID_NET_NAME_SLOT
251           property might be derived for those controllers. This would cause a
252           naming conflict if the property is selected as the device name.
253           Now, we detect this situation and don't produce the
254           ID_NET_NAME_SLOT property.
255
256       v249
257           PCI hotplug slot names for the s390 PCI driver are a hexadecimal
258           representation of the function_id device attribute. This attribute
259           is now used to build the ID_NET_NAME_SLOT. Before that, all slot
260           names were parsed as decimal numbers, which could either result in
261           an incorrect value of the ID_NET_NAME_SLOT property or none at all.
262
263           Some firmware and hypervisor implementations report unreasonable
264           high numbers for the onboard index. To prevent the generation of
265           bogus onbard interface names, index numbers greater than 16381
266           (2^14-1) were ignored. For s390 PCI devices index values up to
267           65535 (2^16-1) are valid. To account for that, the limit is
268           increased to now 65535.
269
270           The udev rule NAME= replaces ":", "/", and "%" with an underscore
271           ("_"), and refuses strings which contain only numerics.
272
273       Note that latest may be used to denote the latest scheme known (to this
274       particular version of systemd).
275

EXAMPLES

277       Example 1. Using udevadm test-builtin to display device properties
278
279           $ udevadm test-builtin net_id /sys/class/net/enp0s31f6
280           ...
281           Using default interface naming scheme 'v243'.
282           ID_NET_NAMING_SCHEME=v243
283           ID_NET_NAME_MAC=enx54ee75cb1dc0
284           ID_OUI_FROM_DATABASE=Wistron InfoComm(Kunshan)Co.,Ltd.
285           ID_NET_NAME_PATH=enp0s31f6
286           ...
287
288       Example 2. PCI Ethernet card with firmware index "1"
289
290           ID_NET_NAME_ONBOARD=eno1
291           ID_NET_NAME_ONBOARD_LABEL=Ethernet Port 1
292
293
294       Example 3. PCI Ethernet card in hotplug slot with firmware index number
295
296           # /sys/devices/pci0000:00/0000:00:1c.3/0000:05:00.0/net/ens1
297           ID_NET_NAME_MAC=enx000000000466
298           ID_NET_NAME_PATH=enp5s0
299           ID_NET_NAME_SLOT=ens1
300
301       Example 4. PCI Ethernet multi-function card with 2 ports
302
303           # /sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/enp2s0f0
304           ID_NET_NAME_MAC=enx78e7d1ea46da
305           ID_NET_NAME_PATH=enp2s0f0
306
307           # /sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.1/net/enp2s0f1
308           ID_NET_NAME_MAC=enx78e7d1ea46dc
309           ID_NET_NAME_PATH=enp2s0f1
310
311       Example 5. PCI WLAN card
312
313           # /sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlp3s0
314           ID_NET_NAME_MAC=wlx0024d7e31130
315           ID_NET_NAME_PATH=wlp3s0
316
317       Example 6. PCI IB host adapter with 2 ports
318
319           # /sys/devices/pci0000:00/0000:00:03.0/0000:15:00.0/net/ibp21s0f0
320           ID_NET_NAME_PATH=ibp21s0f0
321
322           # /sys/devices/pci0000:00/0000:00:03.0/0000:15:00.1/net/ibp21s0f1
323           ID_NET_NAME_PATH=ibp21s0f1
324
325       Example 7. USB built-in 3G modem
326
327           # /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.4/2-1.4:1.6/net/wwp0s29u1u4i6
328           ID_NET_NAME_MAC=wwx028037ec0200
329           ID_NET_NAME_PATH=wwp0s29u1u4i6
330
331       Example 8. USB Android phone
332
333           # /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/net/enp0s29u1u2
334           ID_NET_NAME_MAC=enxd626b3450fb5
335           ID_NET_NAME_PATH=enp0s29u1u2
336
337       Example 9. s390 grouped CCW interface
338
339           # /sys/devices/css0/0.0.0007/0.0.f5f0/group_device/net/encf5f0
340           ID_NET_NAME_MAC=enx026d3c00000a
341           ID_NET_NAME_PATH=encf5f0
342

SEE ALSO

344       udev(7), udevadm(8), Predictable Network Interface Names[1], systemd-
345       nspawn(1)
346

NOTES

348        1. Predictable Network Interface Names
349           https://systemd.io/PREDICTABLE_INTERFACE_NAMES
350
351
352
353systemd 249                                       SYSTEMD.NET-NAMING-SCHEME(7)
Impressum