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, ID_NET_NAME_SLOT=prefixxslot,
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           ├────────────────────────────────────────────────────────────┼────────────────────────────┤
103prefix Xnumber                                              │ VIF interface number (Xen) │
104           ├────────────────────────────────────────────────────────────┼────────────────────────────┤
105           │... bnumber                                                 │ Broadcom bus (BCMA) core   │
106           │                                                            │ number                     │
107           ├────────────────────────────────────────────────────────────┼────────────────────────────┤
108           │... uport... [cconfig] [iinterface]                         │ USB port number chain      │
109           ├────────────────────────────────────────────────────────────┼────────────────────────────┤
110           │... vslot                                                   │ SR-VIO slot number         │
111           └────────────────────────────────────────────────────────────┴────────────────────────────┘
112           The PCI domain is only prepended when it is not 0. All
113           multi-function PCI devices will carry the ffunction number in the
114           device name, including the function 0 device. For
115           non-multi-function devices, the number is suppressed if 0. The port
116           name port_name is used, or the port number ddev_port if the name is
117           not known.
118
119           For BCMA devices, the core number is suppressed when 0.
120
121           For USB devices the full chain of port numbers of hubs is composed.
122           If the name gets longer than the maximum number of 15 characters,
123           the name is not exported. The usual USB configuration number 1 and
124           interface number 0 values are suppressed.
125
126           SR-IOV virtual devices are named based on the name of the parent
127           interface, with a suffix of v and the virtual device number, with
128           any leading zeros removed. The bus number is ignored.
129
130           In some configurations a parent PCI bridge of a given network
131           controller may be associated with a slot. In such case we don't
132           generate this device property to avoid possible naming conflicts.
133
134       ID_NET_NAME_PATH=prefixcbus_id,
135       ID_NET_NAME_PATH=prefixavendormodeliinstance,
136       ID_NET_NAME_PATH=prefixiaddressnport_name,
137       ID_NET_NAME_PATH=prefix[Pdomain]pbussslot[ffunction][nphys_port_name|ddev_port],
138       ID_NET_NAME_PATH=prefix[Pdomain]pbussslot[ffunction][nphys_port_name|ddev_port]bnumber,
139       ID_NET_NAME_PATH=prefix[Pdomain]pbussslot[ffunction][nphys_port_name|ddev_port]uport...[cconfig][iinterface]
140           This property describes the device installation location. Different
141           schemes are used depending on the bus type, as described in the
142           table below. For BCMA and USB devices, PCI path information must
143           known, and the full name consists of the prefix, PCI slot
144           identifier, and USB or BCMA location. The first two parts are
145           denoted as "..." in the table below.
146
147           Table 3. Path naming schemes
148           ┌──────────────────────────────────────────────────────────────────────┬───────────────────────────┐
149Format                                                                Description               
150           ├──────────────────────────────────────────────────────────────────────┼───────────────────────────┤
151prefix cbus_id                                                        │ CCW or grouped CCW device │
152           │                                                                      │ identifier                │
153           ├──────────────────────────────────────────────────────────────────────┼───────────────────────────┤
154prefix avendor model iinstance                                        │ ACPI path names for ARM64 │
155           │                                                                      │ platform devices          │
156           ├──────────────────────────────────────────────────────────────────────┼───────────────────────────┤
157prefix iaddress nport_name                                            │ Netdevsim (simulated      │
158           │                                                                      │ networking device) device │
159           │                                                                      │ number and port name      │
160           ├──────────────────────────────────────────────────────────────────────┼───────────────────────────┤
161prefix [Pdomain] pbus sslot [ffunction] [nphys_port_name | ddev_port] │ PCI geographical location │
162           ├──────────────────────────────────────────────────────────────────────┼───────────────────────────┤
163           │... bnumber                                                           │ Broadcom bus (BCMA) core  │
164           │                                                                      │ number                    │
165           ├──────────────────────────────────────────────────────────────────────┼───────────────────────────┤
166           │... uport... [cconfig] [iinterface]                                   │ USB port number chain     │
167           └──────────────────────────────────────────────────────────────────────┴───────────────────────────┘
168           CCW and grouped CCW devices are found in IBM System Z mainframes.
169           Any leading zeros and dots are suppressed.
170
171           For PCI, BCMA, and USB devices, the same rules as described above
172           for slot naming are used.
173

HISTORY

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

EXAMPLES

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

SEE ALSO

360       udev(7), udevadm(8), Predictable Network Interface Names[1], systemd-
361       nspawn(1)
362

NOTES

364        1. Predictable Network Interface Names
365           https://systemd.io/PREDICTABLE_INTERFACE_NAMES
366
367
368
369systemd 251                                       SYSTEMD.NET-NAMING-SCHEME(7)
Impressum