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