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       ID_NET_NAME_PATH=prefixcbus_id,
129       ID_NET_NAME_PATH=prefixavendormodeliinstance,
130       ID_NET_NAME_PATH=prefixiaddressnport_name,
131       ID_NET_NAME_PATH=prefix[Pdomain]pbussslot[ffunction][nphys_port_name|ddev_port],
132       ID_NET_NAME_PATH=prefix[Pdomain]pbussslot[ffunction][nphys_port_name|ddev_port]bnumber,
133       ID_NET_NAME_PATH=prefix[Pdomain]pbussslot[ffunction][nphys_port_name|ddev_port]uport...[cconfig][iinterface]
134           This property describes the device installation location. Different
135           schemes are used depending on the bus type, as described in the
136           table below. For BCMA and USB devices, PCI path information must
137           known, and the full name consists of the prefix, PCI slot
138           identifier, and USB or BCMA location. The first two parts are
139           denoted as "..." in the table below.
140
141           Table 3. Path naming schemes
142           ┌──────────────────────────────────────────────────────────────────────┬───────────────────────────┐
143Format                                                                Description               
144           ├──────────────────────────────────────────────────────────────────────┼───────────────────────────┤
145prefix cbus_id                                                        │ CCW or grouped CCW device │
146           │                                                                      │ identifier                │
147           ├──────────────────────────────────────────────────────────────────────┼───────────────────────────┤
148prefix avendor model iinstance                                        │ ACPI path names for ARM64 │
149           │                                                                      │ platform devices          │
150           ├──────────────────────────────────────────────────────────────────────┼───────────────────────────┤
151prefix iaddress nport_name                                            │ Netdevsim (simulated      │
152           │                                                                      │ networking device) device │
153           │                                                                      │ number and port name      │
154           ├──────────────────────────────────────────────────────────────────────┼───────────────────────────┤
155prefix [Pdomain] pbus sslot [ffunction] [nphys_port_name | ddev_port] │ PCI geographical location │
156           ├──────────────────────────────────────────────────────────────────────┼───────────────────────────┤
157           │... bnumber                                                           │ Broadcom bus (BCMA) core  │
158           │                                                                      │ number                    │
159           ├──────────────────────────────────────────────────────────────────────┼───────────────────────────┤
160           │... uport... [cconfig] [iinterface]                                   │ USB port number chain     │
161           └──────────────────────────────────────────────────────────────────────┴───────────────────────────┘
162           CCW and grouped CCW devices are found in IBM System Z mainframes.
163           Any leading zeros and dots are suppressed.
164
165           For PCI, BCMA, and USB devices, the same rules as described above
166           for slot naming are used.
167

HISTORY

169       The following "naming schemes" have been defined:
170
171       v238
172           This is the naming scheme that was implemented in systemd 238.
173
174       v239
175           Naming was changed for virtual network interfaces created with
176           SR-IOV and NPAR and for devices where the PCI network controller
177           device does not have a slot number associated.
178
179           SR-IOV virtual devices are named based on the name of the parent
180           interface, with a suffix of "vport", where port is the virtual
181           device number. Previously those virtual devices were named as if
182           completely independent.
183
184           The ninth and later NPAR virtual devices are named following the
185           scheme used for the first eight NPAR partitions. Previously those
186           devices were not renamed and the kernel default ("ethN") was used.
187
188           Names are also generated for PCI devices where the PCI network
189           controller device does not have an associated slot number itself,
190           but one of its parents does. Previously those devices were not
191           renamed and the kernel default was used.
192
193       v240
194           The "ib" prefix and stable names for infiniband devices are
195           introduced. Previously those devices were not renamed.
196
197           The ACPI index field (used in ID_NET_NAME_ONBOARD=) is now also
198           used when 0.
199
200           A new naming policy NamePolicy=keep was introduced. With this
201           policy, if the network device name was already set by userspace,
202           the device will not be renamed again. Previously, this naming
203           policy applied implicitly, and now it must be explicitly requested.
204           Effectively, this means that network devices will be renamed
205           according to the configuration, even if they have been renamed
206           already, if keep is not specified as the naming policy in the .link
207           file. See systemd.link(5) for a description of NamePolicy=.
208
209       v241
210           MACAddressPolicy=persistent was extended to set MAC addresses based
211           on the device name. Previously addresses were only based on the
212           ID_NET_NAME_* attributes, which meant that interface names would
213           never be generated for virtual devices. Now a persistent address
214           will be generated for most devices, including in particular
215           bridges.
216
217           Note: when userspace does not set a MAC address for a bridge
218           device, the kernel will initially assign a random address, and then
219           change it when the first device is enslaved to the bridge. With
220           this naming policy change, bridges get a persistent MAC address
221           based on the bridge name instead of the first enslaved device.
222
223       v243
224           Support for renaming netdevsim (simulated networking) devices was
225           added. Previously those devices were not renamed.
226
227           Previously two-letter interface type prefix was prepended to
228           ID_NET_LABEL_ONBOARD=. This is not done anymore.
229
230       v245
231           When systemd-nspawn(1) derives the name for the host side of the
232           network interface created with --network-veth from the container
233           name it previously simply truncated the result at 15 characters if
234           longer (since that's the maximum length for network interface
235           names). From now on, for any interface name that would be longer
236           than 15 characters the last 4 characters are set to a 24bit hash
237           value of the full interface name. This way network interface name
238           collisions between multiple similarly named containers (who only
239           differ in container name suffix) should be less likely (but still
240           possible, since the 24bit hash value is very small).
241
242       Note that latest may be used to denote the latest scheme known (to this
243       particular version of systemd.
244

EXAMPLES

246       Example 1. Using udevadm test-builtin to display device properties
247
248           $ udevadm test-builtin net_id /sys/class/net/enp0s31f6
249           ...
250           Using default interface naming scheme 'v243'.
251           ID_NET_NAMING_SCHEME=v243
252           ID_NET_NAME_MAC=enx54ee75cb1dc0
253           ID_OUI_FROM_DATABASE=Wistron InfoComm(Kunshan)Co.,Ltd.
254           ID_NET_NAME_PATH=enp0s31f6
255           ...
256
257       Example 2. PCI Ethernet card with firmware index "1"
258
259           ID_NET_NAME_ONBOARD=eno1
260           ID_NET_NAME_ONBOARD_LABEL=Ethernet Port 1
261
262
263       Example 3. PCI Ethernet card in hotplug slot with firmware index number
264
265           # /sys/devices/pci0000:00/0000:00:1c.3/0000:05:00.0/net/ens1
266           ID_NET_NAME_MAC=enx000000000466
267           ID_NET_NAME_PATH=enp5s0
268           ID_NET_NAME_SLOT=ens1
269
270       Example 4. PCI Ethernet multi-function card with 2 ports
271
272           # /sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/enp2s0f0
273           ID_NET_NAME_MAC=enx78e7d1ea46da
274           ID_NET_NAME_PATH=enp2s0f0
275
276           # /sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.1/net/enp2s0f1
277           ID_NET_NAME_MAC=enx78e7d1ea46dc
278           ID_NET_NAME_PATH=enp2s0f1
279
280       Example 5. PCI WLAN card
281
282           # /sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlp3s0
283           ID_NET_NAME_MAC=wlx0024d7e31130
284           ID_NET_NAME_PATH=wlp3s0
285
286       Example 6. PCI IB host adapter with 2 ports
287
288           # /sys/devices/pci0000:00/0000:00:03.0/0000:15:00.0/net/ibp21s0f0
289           ID_NET_NAME_PATH=ibp21s0f0
290
291           # /sys/devices/pci0000:00/0000:00:03.0/0000:15:00.1/net/ibp21s0f1
292           ID_NET_NAME_PATH=ibp21s0f1
293
294       Example 7. USB built-in 3G modem
295
296           # /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.4/2-1.4:1.6/net/wwp0s29u1u4i6
297           ID_NET_NAME_MAC=wwx028037ec0200
298           ID_NET_NAME_PATH=wwp0s29u1u4i6
299
300       Example 8. USB Android phone
301
302           # /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/net/enp0s29u1u2
303           ID_NET_NAME_MAC=enxd626b3450fb5
304           ID_NET_NAME_PATH=enp0s29u1u2
305
306       Example 9. s390 grouped CCW interface
307
308           # /sys/devices/css0/0.0.0007/0.0.f5f0/group_device/net/encf5f0
309           ID_NET_NAME_MAC=enx026d3c00000a
310           ID_NET_NAME_PATH=encf5f0
311

SEE ALSO

313       udev(7), udevadm(8), Predictable Network Interface Names[1], systemd-
314       nspawn(1)
315

NOTES

317        1. Predictable Network Interface Names
318           https://systemd.io/PREDICTABLE_INTERFACE_NAMES
319
320
321
322systemd 245                                       SYSTEMD.NET-NAMING-SCHEME(7)
Impressum