1SYSTEMD.NET-NAMING-SCHEME(7)systemd.net-naming-schemSeYSTEMD.NET-NAMING-SCHEME(7)
2
3
4
6 systemd.net-naming-scheme - Network device naming schemes
7
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
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 ┌───────┬────────────────────────────┐
47 │Prefix │ Description │
48 ├───────┼────────────────────────────┤
49 │en │ Ethernet │
50 ├───────┼────────────────────────────┤
51 │ib │ InfiniBand │
52 ├───────┼────────────────────────────┤
53 │sl │ Serial line IP (slip) │
54 ├───────┼────────────────────────────┤
55 │wl │ Wireless local area │
56 │ │ network (WLAN) │
57 ├───────┼────────────────────────────┤
58 │ww │ 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, ID_NET_NAME_ONBOARD=prefixdnumber
65 This name is set based on the numeric ordering information given by
66 the firmware for on-board devices. Different schemes are used
67 depending on the firmware type, as described in the table below.
68
69 Table 2. On-board naming schemes
70 ┌──────────────┬────────────────────────┐
71 │Format │ Description │
72 ├──────────────┼────────────────────────┤
73 │prefixonumber │ PCI on-board index │
74 ├──────────────┼────────────────────────┤
75 │prefixdnumber │ Devicetree alias index │
76 └──────────────┴────────────────────────┘
77
78 ID_NET_LABEL_ONBOARD=prefix label
79 This property is set based on textual label given by the firmware
80 for on-board devices. The name consists of the prefix concatenated
81 with the label. This is only available for PCI devices.
82
83 ID_NET_NAME_MAC=prefixxAABBCCDDEEFF
84 This name consists of the prefix, letter x, and 12 hexadecimal
85 digits of the MAC address. It is available if the device has a
86 fixed MAC address. Because this name is based on an attribute of
87 the card itself, it remains "stable" when the device is moved (even
88 between machines), but will change when the hardware is replaced.
89
90 ID_NET_NAME_SLOT=prefix[Pdomain]sslot[ffunction][nport_name|ddev_port],
91 ID_NET_NAME_SLOT=prefixvslot, ID_NET_NAME_SLOT=prefixxslot,
92 ID_NET_NAME_SLOT=prefix[Pdomain]sslot[ffunction][nport_name|ddev_port]bnumber,
93 ID_NET_NAME_SLOT=prefix[Pdomain]sslot[ffunction][nport_name|ddev_port]uport...[cconfig][iinterface],
94 ID_NET_NAME_SLOT=prefix[Pdomain]sslot[ffunction][nport_name|ddev_port]vslot
95 This property describes the slot position. Different schemes are
96 used depending on the bus type, as described in the table below. In
97 case of USB, BCMA, and SR-VIO devices, the full name consists of
98 the prefix, PCI slot identifier, and USB or BCMA or SR-VIO slot
99 identifier. The first two parts are denoted as "..." in the table
100 below.
101
102 Table 3. Slot naming schemes
103 ┌────────────────────────────────────────────────────────────┬────────────────────────────┐
104 │Format │ Description │
105 ├────────────────────────────────────────────────────────────┼────────────────────────────┤
106 │prefix [Pdomain] sslot [ffunction] [nport_name | ddev_port] │ PCI slot number │
107 ├────────────────────────────────────────────────────────────┼────────────────────────────┤
108 │prefix vslot │ VIO slot number (IBM │
109 │ │ PowerVM) │
110 ├────────────────────────────────────────────────────────────┼────────────────────────────┤
111 │prefix Xnumber │ VIF interface number (Xen) │
112 ├────────────────────────────────────────────────────────────┼────────────────────────────┤
113 │... bnumber │ Broadcom bus (BCMA) core │
114 │ │ number │
115 ├────────────────────────────────────────────────────────────┼────────────────────────────┤
116 │... uport... [cconfig] [iinterface] │ USB port number chain │
117 ├────────────────────────────────────────────────────────────┼────────────────────────────┤
118 │... vslot │ SR-VIO slot number │
119 └────────────────────────────────────────────────────────────┴────────────────────────────┘
120 The PCI domain is only prepended when it is not 0. All
121 multi-function PCI devices will carry the ffunction number in the
122 device name, including the function 0 device. For
123 non-multi-function devices, the number is suppressed if 0. The port
124 name port_name is used, or the port number ddev_port if the name is
125 not known.
126
127 For BCMA devices, the core number is suppressed when 0.
128
129 For USB devices the full chain of port numbers of hubs is composed.
130 If the name gets longer than the maximum number of 15 characters,
131 the name is not exported. The usual USB configuration number 1 and
132 interface number 0 values are suppressed.
133
134 SR-IOV virtual devices are named based on the name of the parent
135 interface, with a suffix of v and the virtual device number, with
136 any leading zeros removed. The bus number is ignored.
137
138 In some configurations a parent PCI bridge of a given network
139 controller may be associated with a slot. In such case we don't
140 generate this device property to avoid possible naming conflicts.
141
142 ID_NET_NAME_PATH=prefixcbus_id,
143 ID_NET_NAME_PATH=prefixavendormodeliinstance,
144 ID_NET_NAME_PATH=prefixiaddressnport_name,
145 ID_NET_NAME_PATH=prefixuport...,
146 ID_NET_NAME_PATH=prefix[Pdomain]pbussslot[ffunction][nphys_port_name|ddev_port],
147 ID_NET_NAME_PATH=prefix[Pdomain]pbussslot[ffunction][nphys_port_name|ddev_port]bnumber,
148 ID_NET_NAME_PATH=prefix[Pdomain]pbussslot[ffunction][nphys_port_name|ddev_port]uport...[cconfig][iinterface]
149 This property describes the device installation location. Different
150 schemes are used depending on the bus type, as described in the
151 table below. For BCMA and USB devices, PCI path information must
152 known, and the full name consists of the prefix, PCI slot
153 identifier, and USB or BCMA location. The first two parts are
154 denoted as "..." in the table below.
155
156 Table 4. Path naming schemes
157 ┌──────────────────────────────────────────────────────────────────────┬───────────────────────────┐
158 │Format │ Description │
159 ├──────────────────────────────────────────────────────────────────────┼───────────────────────────┤
160 │prefix cbus_id │ CCW or grouped CCW device │
161 │ │ identifier │
162 ├──────────────────────────────────────────────────────────────────────┼───────────────────────────┤
163 │prefix avendor model iinstance │ ACPI path names for ARM64 │
164 │ │ platform devices │
165 ├──────────────────────────────────────────────────────────────────────┼───────────────────────────┤
166 │prefix iaddress nport_name │ Netdevsim (simulated │
167 │ │ networking device) device │
168 │ │ number and port name │
169 ├──────────────────────────────────────────────────────────────────────┼───────────────────────────┤
170 │prefix [Pdomain] pbus sslot [ffunction] [nphys_port_name | ddev_port] │ PCI geographical location │
171 ├──────────────────────────────────────────────────────────────────────┼───────────────────────────┤
172 │... bnumber │ Broadcom bus (BCMA) core │
173 │ │ number │
174 ├──────────────────────────────────────────────────────────────────────┼───────────────────────────┤
175 │... uport... [cconfig] [iinterface] │ USB port number chain │
176 └──────────────────────────────────────────────────────────────────────┴───────────────────────────┘
177 CCW and grouped CCW devices are found in IBM System Z mainframes.
178 Any leading zeros and dots are suppressed.
179
180 For PCI, BCMA, and USB devices, the same rules as described above
181 for slot naming are used.
182
184 The following "naming schemes" have been defined (which may be chosen
185 at system boot-up time via the net.naming-scheme= kernel command line
186 switch, see above):
187
188 v238
189 This is the naming scheme that was implemented in systemd 238.
190
191 v239
192 Naming was changed for virtual network interfaces created with
193 SR-IOV and NPAR and for devices where the PCI network controller
194 device does not have a slot number associated.
195
196 SR-IOV virtual devices are named based on the name of the parent
197 interface, with a suffix of "vport", where port is the virtual
198 device number. Previously those virtual devices were named as if
199 completely independent.
200
201 The ninth and later NPAR virtual devices are named following the
202 scheme used for the first eight NPAR partitions. Previously those
203 devices were not renamed and the kernel default ("ethN") was used.
204
205 Names are also generated for PCI devices where the PCI network
206 controller device does not have an associated slot number itself,
207 but one of its parents does. Previously those devices were not
208 renamed and the kernel default was used.
209
210 v240
211 The "ib" prefix and stable names for infiniband devices are
212 introduced. Previously those devices were not renamed.
213
214 The ACPI index field (used in ID_NET_NAME_ONBOARD=) is now also
215 used when 0.
216
217 A new naming policy NamePolicy=keep was introduced. With this
218 policy, if the network device name was already set by userspace,
219 the device will not be renamed again. Previously, this naming
220 policy applied implicitly, and now it must be explicitly requested.
221 Effectively, this means that network devices will be renamed
222 according to the configuration, even if they have been renamed
223 already, if keep is not specified as the naming policy in the .link
224 file. See systemd.link(5) for a description of NamePolicy=.
225
226 v241
227 MACAddressPolicy=persistent was extended to set MAC addresses based
228 on the device name. Previously addresses were only based on the
229 ID_NET_NAME_* attributes, which meant that interface names would
230 never be generated for virtual devices. Now a persistent address
231 will be generated for most devices, including in particular
232 bridges.
233
234 Note: when userspace does not set a MAC address for a bridge
235 device, the kernel will initially assign a random address, and then
236 change it when the first device is enslaved to the bridge. With
237 this naming policy change, bridges get a persistent MAC address
238 based on the bridge name instead of the first enslaved device.
239
240 v243
241 Support for renaming netdevsim (simulated networking) devices was
242 added. Previously those devices were not renamed.
243
244 Previously two-letter interface type prefix was prepended to
245 ID_NET_LABEL_ONBOARD=. This is not done anymore.
246
247 v245
248 When systemd-nspawn(1) derives the name for the host side of the
249 network interface created with --network-veth from the container
250 name it previously simply truncated the result at 15 characters if
251 longer (since that's the maximum length for network interface
252 names). From now on, for any interface name that would be longer
253 than 15 characters the last 4 characters are set to a 24bit hash
254 value of the full interface name. This way network interface name
255 collisions between multiple similarly named containers (who only
256 differ in container name suffix) should be less likely (but still
257 possible, since the 24bit hash value is very small).
258
259 v247
260 When a PCI slot is associated with a PCI bridge that has multiple
261 child network controllers, the same value of the ID_NET_NAME_SLOT
262 property might be derived for those controllers. This would cause a
263 naming conflict if the property is selected as the device name.
264 Now, we detect this situation and don't produce the
265 ID_NET_NAME_SLOT property.
266
267 v249
268 PCI hotplug slot names for the s390 PCI driver are a hexadecimal
269 representation of the function_id device attribute. This attribute
270 is now used to build the ID_NET_NAME_SLOT. Before that, all slot
271 names were parsed as decimal numbers, which could either result in
272 an incorrect value of the ID_NET_NAME_SLOT property or none at all.
273
274 Some firmware and hypervisor implementations report unreasonably
275 high numbers for the on-board index. To prevent the generation of
276 bogus onbard interface names, index numbers greater than 16381
277 (2¹⁴-1) were ignored. For s390 PCI devices index values up to 65535
278 (2¹⁶-1) are valid. To account for that, the limit was increased to
279 65535.
280
281 The udev rule NAME= replaces ":", "/", and "%" with an underscore
282 ("_"), and refuses strings which contain only numerics.
283
284 v250
285 Added naming scheme for Xen netfront "vif" interfaces based on the
286 guest side VIF number set from the Xen config (or the interface
287 index in AWS EC2).
288
289 v251
290 Since version v247 we no longer set ID_NET_NAME_SLOT if we detect
291 that a PCI device associated with a slot is a PCI bridge as that
292 would create naming conflict when there are more child devices on
293 that bridge. Now, this is relaxed and we will use slot information
294 to generate the name based on it but only if the PCI device has
295 multiple functions. This is safe because distinct function number
296 is a part of the device name for multifunction devices.
297
298 v252
299 Added naming scheme for platform devices with devicetree aliases.
300
301 v253
302 Set ID_NET_NAME_PATH for usb devices not connected via a PCI bus.
303
304 Note that latest may be used to denote the latest scheme known (to this
305 particular version of systemd).
306
308 Example 1. Using udevadm test-builtin to display device properties
309
310 $ udevadm test-builtin net_id /sys/class/net/enp0s31f6
311 ...
312 Using default interface naming scheme 'v243'.
313 ID_NET_NAMING_SCHEME=v243
314 ID_NET_NAME_MAC=enx54ee75cb1dc0
315 ID_OUI_FROM_DATABASE=Wistron InfoComm(Kunshan)Co.,Ltd.
316 ID_NET_NAME_PATH=enp0s31f6
317 ...
318
319 Example 2. PCI Ethernet card with firmware index "1"
320
321 ID_NET_NAME_ONBOARD=eno1
322 ID_NET_NAME_ONBOARD_LABEL=Ethernet Port 1
323
324
325 Example 3. PCI Ethernet card in hotplug slot with firmware index number
326
327 # /sys/devices/pci0000:00/0000:00:1c.3/0000:05:00.0/net/ens1
328 ID_NET_NAME_MAC=enx000000000466
329 ID_NET_NAME_PATH=enp5s0
330 ID_NET_NAME_SLOT=ens1
331
332 Example 4. PCI Ethernet multi-function card with 2 ports
333
334 # /sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/enp2s0f0
335 ID_NET_NAME_MAC=enx78e7d1ea46da
336 ID_NET_NAME_PATH=enp2s0f0
337
338 # /sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.1/net/enp2s0f1
339 ID_NET_NAME_MAC=enx78e7d1ea46dc
340 ID_NET_NAME_PATH=enp2s0f1
341
342 Example 5. PCI WLAN card
343
344 # /sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlp3s0
345 ID_NET_NAME_MAC=wlx0024d7e31130
346 ID_NET_NAME_PATH=wlp3s0
347
348 Example 6. PCI IB host adapter with 2 ports
349
350 # /sys/devices/pci0000:00/0000:00:03.0/0000:15:00.0/net/ibp21s0f0
351 ID_NET_NAME_PATH=ibp21s0f0
352
353 # /sys/devices/pci0000:00/0000:00:03.0/0000:15:00.1/net/ibp21s0f1
354 ID_NET_NAME_PATH=ibp21s0f1
355
356 Example 7. USB built-in 3G modem
357
358 # /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.4/2-1.4:1.6/net/wwp0s29u1u4i6
359 ID_NET_NAME_MAC=wwx028037ec0200
360 ID_NET_NAME_PATH=wwp0s29u1u4i6
361
362 Example 8. USB Android phone
363
364 # /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/net/enp0s29u1u2
365 ID_NET_NAME_MAC=enxd626b3450fb5
366 ID_NET_NAME_PATH=enp0s29u1u2
367
368 Example 9. s390 grouped CCW interface
369
370 # /sys/devices/css0/0.0.0007/0.0.f5f0/group_device/net/encf5f0
371 ID_NET_NAME_MAC=enx026d3c00000a
372 ID_NET_NAME_PATH=encf5f0
373
375 udev(7), udevadm(8), Predictable Network Interface Names[1], systemd-
376 nspawn(1)
377
379 1. Predictable Network Interface Names
380 https://systemd.io/PREDICTABLE_INTERFACE_NAMES
381
382
383
384systemd 253 SYSTEMD.NET-NAMING-SCHEME(7)