2019-05-09 13:34:30 +03:00
<?xml version='1.0'?>
< !DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
2023-12-25 17:48:33 +03:00
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
2020-11-09 07:23:58 +03:00
<!-- SPDX - License - Identifier: LGPL - 2.1 - or - later -->
2019-05-09 13:34:30 +03:00
2023-08-22 19:52:02 +03:00
<refentry id= "systemd.net-naming-scheme" xmlns:xi= "http://www.w3.org/2001/XInclude" >
2019-05-09 13:34:30 +03:00
<refentryinfo >
<title > systemd.net-naming-scheme</title>
<productname > systemd</productname>
</refentryinfo>
<refmeta >
<refentrytitle > systemd.net-naming-scheme</refentrytitle>
<manvolnum > 7</manvolnum>
</refmeta>
<refnamediv >
<refname > systemd.net-naming-scheme</refname>
<refpurpose > Network device naming schemes</refpurpose>
</refnamediv>
<refsect1 >
<title > Description</title>
2019-06-17 10:21:57 +03:00
<para > Network interfaces names and MAC addresses may be generated based on certain stable interface
attributes. This is possible when there is enough information about the device to generate those
attributes and the use of this information is configured. This page describes interface naming, i.e. what
possible names may be generated. Those names are generated by the
2019-05-09 13:34:30 +03:00
<citerefentry > <refentrytitle > systemd-udevd.service</refentrytitle> <manvolnum > 8</manvolnum> </citerefentry>
builtin <command > net_id</command> and exported as udev properties
(<varname > ID_NET_NAME_ONBOARD=</varname> , <varname > ID_NET_LABEL_ONBOARD=</varname> ,
<varname > ID_NET_NAME_PATH=</varname> , <varname > ID_NET_NAME_SLOT=</varname> ).</para>
2019-06-17 10:21:57 +03:00
<para > Names and MAC addresses are derived from various stable device metadata attributes. Newer versions
of udev take more of these attributes into account, improving (and thus possibly changing) the names and
addresses used for the same devices. Different versions of those generation rules are called "naming
schemes". The default naming scheme is chosen at compilation time. Usually this will be the latest
implemented version, but it is also possible to set one of the older versions to preserve
compatibility. This may be useful for example for distributions, which may introduce new versions of
2019-06-27 10:54:20 +03:00
systemd in stable releases without changing the naming scheme. The naming scheme may also be overridden
2019-06-17 10:21:57 +03:00
using the <varname > net.naming-scheme=</varname> kernel command line switch, see
2019-05-09 13:34:30 +03:00
<citerefentry > <refentrytitle > systemd-udevd.service</refentrytitle> <manvolnum > 8</manvolnum> </citerefentry> .
Available naming schemes are described below.</para>
2019-11-04 12:43:05 +03:00
<para > After the udev properties have been generated, appropriate udev rules may be used to actually rename
2019-06-17 10:21:57 +03:00
devices based on those properties. See the description of <varname > NamePolicy=</varname> and
<varname > MACAddressPolicy=</varname> in
<citerefentry > <refentrytitle > systemd.link</refentrytitle> <manvolnum > 5</manvolnum> </citerefentry> .</para>
2019-06-24 01:24:18 +03:00
<para > Note that while the concept of network interface naming schemes is primarily relevant in the
context of <filename > systemd-udevd.service</filename> , the
<citerefentry > <refentrytitle > systemd-nspawn</refentrytitle> <manvolnum > 1</manvolnum> </citerefentry>
container manager also takes it into account when naming network interfaces, see below.</para>
2019-05-09 13:34:30 +03:00
</refsect1>
<refsect1 >
2023-10-31 19:12:45 +03:00
<title > Policies</title>
2019-05-09 13:34:30 +03:00
<para > All names start with a two-character prefix that signifies the interface type.</para>
<table >
<title > Two character prefixes based on the type of interface</title>
<tgroup cols= '2' >
<thead >
<row >
<entry > Prefix</entry>
<entry > Description</entry>
</row>
</thead>
<tbody >
<row >
<entry > <constant > en</constant> </entry>
<entry > Ethernet</entry>
</row>
<row >
<entry > <constant > ib</constant> </entry>
<entry > InfiniBand</entry>
</row>
<row >
<entry > <constant > sl</constant> </entry>
2020-01-07 17:13:10 +03:00
<entry > Serial line IP (slip)</entry>
2019-05-09 13:34:30 +03:00
</row>
<row >
<entry > <constant > wl</constant> </entry>
<entry > Wireless local area network (WLAN)</entry>
</row>
<row >
<entry > <constant > ww</constant> </entry>
<entry > Wireless wide area network (WWAN)</entry>
</row>
</tbody>
</tgroup>
</table>
<para > The udev <command > net_id</command> builtin exports the following udev device properties:</para>
<variablelist >
<varlistentry >
2023-12-24 12:39:08 +03:00
<term > <varname > ID_NET_NAME_ONBOARD=</varname> <replaceable > prefix</replaceable> <constant > o</constant> <replaceable > number</replaceable> </term>
<term > <varname > ID_NET_NAME_ONBOARD=</varname> <replaceable > prefix</replaceable> <constant > d</constant> <replaceable > number</replaceable> </term>
2019-05-09 13:34:30 +03:00
2020-01-07 20:01:56 +03:00
<listitem > <para > This name is set based on the numeric ordering information given by the firmware
2023-05-17 13:24:04 +03:00
for on-board devices. Different schemes are used depending on the firmware type, as described in
the table below.</para>
udev: net_id: Use devicetree aliases when available
Devicetree firmware contains an "aliases" node, containing various
aliases for devices described by the firmware. For ethernet devices,
these are named "ethernet0", "ethernet1", etc. They provide a convenient
means of numbering ethernet devices, especially on systems with no other
stable number other than the address. In particular, U-Boot already uses
these aliases to name its ethernet devices.
Previously, there have been attempts (such as [1]) to add support for
these aliases to Linux. However, these patches have been rejected
because it is the maintainers' view that naming policy be left to
userspace. Well, systemd is userspace, so here we are.
In terms of implementation, apparently there can be multiple device
trees at once. I have decided to dodge this problem for now, and just
use /proc/device-tree. If it is desired to support multiple device trees
later, then the scheme can be modified to include the device tree's
index. For example, /sys/firmware/devicetree/base2/aliases/ethernet3
might be named enb2d3.
For the moment we only support "ethernetX" aliases. Future patches might
want to also handle "canX" and "wifiX".
It is common on boards with only one ethernet device to use an alias of
just "ethernet". In this case, the index is an implicit 0. In case the
author of the firmware made a mistake, we check to ensure that aliases
of "ethernet" and "ethernet0" do not both exist.
[1] https://patchwork.kernel.org/project/linux-arm-kernel/patch/1399390594-1409-1-git-send-email-boris.brezillon@free-electrons.com/
Closes: #17625
2022-08-09 20:38:26 +03:00
<table >
2023-05-17 13:24:04 +03:00
<title > On-board naming schemes</title>
udev: net_id: Use devicetree aliases when available
Devicetree firmware contains an "aliases" node, containing various
aliases for devices described by the firmware. For ethernet devices,
these are named "ethernet0", "ethernet1", etc. They provide a convenient
means of numbering ethernet devices, especially on systems with no other
stable number other than the address. In particular, U-Boot already uses
these aliases to name its ethernet devices.
Previously, there have been attempts (such as [1]) to add support for
these aliases to Linux. However, these patches have been rejected
because it is the maintainers' view that naming policy be left to
userspace. Well, systemd is userspace, so here we are.
In terms of implementation, apparently there can be multiple device
trees at once. I have decided to dodge this problem for now, and just
use /proc/device-tree. If it is desired to support multiple device trees
later, then the scheme can be modified to include the device tree's
index. For example, /sys/firmware/devicetree/base2/aliases/ethernet3
might be named enb2d3.
For the moment we only support "ethernetX" aliases. Future patches might
want to also handle "canX" and "wifiX".
It is common on boards with only one ethernet device to use an alias of
just "ethernet". In this case, the index is an implicit 0. In case the
author of the firmware made a mistake, we check to ensure that aliases
of "ethernet" and "ethernet0" do not both exist.
[1] https://patchwork.kernel.org/project/linux-arm-kernel/patch/1399390594-1409-1-git-send-email-boris.brezillon@free-electrons.com/
Closes: #17625
2022-08-09 20:38:26 +03:00
<tgroup cols= '2' >
<thead >
<row >
<entry > Format</entry>
<entry > Description</entry>
</row>
</thead>
<tbody >
<row >
<entry > <replaceable > prefix</replaceable> <constant > o</constant> <replaceable > number</replaceable> </entry>
2023-05-17 13:24:04 +03:00
<entry > PCI on-board index</entry>
udev: net_id: Use devicetree aliases when available
Devicetree firmware contains an "aliases" node, containing various
aliases for devices described by the firmware. For ethernet devices,
these are named "ethernet0", "ethernet1", etc. They provide a convenient
means of numbering ethernet devices, especially on systems with no other
stable number other than the address. In particular, U-Boot already uses
these aliases to name its ethernet devices.
Previously, there have been attempts (such as [1]) to add support for
these aliases to Linux. However, these patches have been rejected
because it is the maintainers' view that naming policy be left to
userspace. Well, systemd is userspace, so here we are.
In terms of implementation, apparently there can be multiple device
trees at once. I have decided to dodge this problem for now, and just
use /proc/device-tree. If it is desired to support multiple device trees
later, then the scheme can be modified to include the device tree's
index. For example, /sys/firmware/devicetree/base2/aliases/ethernet3
might be named enb2d3.
For the moment we only support "ethernetX" aliases. Future patches might
want to also handle "canX" and "wifiX".
It is common on boards with only one ethernet device to use an alias of
just "ethernet". In this case, the index is an implicit 0. In case the
author of the firmware made a mistake, we check to ensure that aliases
of "ethernet" and "ethernet0" do not both exist.
[1] https://patchwork.kernel.org/project/linux-arm-kernel/patch/1399390594-1409-1-git-send-email-boris.brezillon@free-electrons.com/
Closes: #17625
2022-08-09 20:38:26 +03:00
</row>
<row >
<entry > <replaceable > prefix</replaceable> <constant > d</constant> <replaceable > number</replaceable> </entry>
<entry > Devicetree alias index</entry>
</row>
</tbody>
</tgroup>
</table>
2023-09-18 18:03:38 +03:00
<xi:include href= "version-info.xml" xpointer= "v243" />
2019-05-09 13:34:30 +03:00
</listitem>
</varlistentry>
<varlistentry >
2023-12-24 12:39:08 +03:00
<term > <varname > ID_NET_LABEL_ONBOARD=</varname> <replaceable > prefix</replaceable> <replaceable > label</replaceable> </term>
2019-05-09 13:34:30 +03:00
2020-01-07 20:01:56 +03:00
<listitem > <para > This property is set based on textual label given by the firmware for on-board
devices. The name consists of the prefix concatenated with the label. This is only available for
PCI devices.
2019-05-09 13:34:30 +03:00
</para>
2023-08-22 19:52:36 +03:00
<xi:include href= "version-info.xml" xpointer= "v243" />
2019-05-09 13:34:30 +03:00
</listitem>
</varlistentry>
<varlistentry >
2023-12-24 12:39:08 +03:00
<term > <varname > ID_NET_NAME_MAC=</varname> <replaceable > prefix</replaceable> <constant > x</constant> <replaceable > AABBCCDDEEFF</replaceable> </term>
2019-05-09 13:34:30 +03:00
<listitem > <para > This name consists of the prefix, letter <constant > x</constant> , and 12 hexadecimal
digits of the MAC address. It is available if the device has a fixed MAC address. Because this name
is based on an attribute of the card itself, it remains "stable" when the device is moved (even
between machines), but will change when the hardware is replaced.</para>
2023-08-22 19:52:36 +03:00
<xi:include href= "version-info.xml" xpointer= "v243" />
2019-05-09 13:34:30 +03:00
</listitem>
</varlistentry>
<varlistentry >
2023-12-24 12:39:08 +03:00
<term > <varname > ID_NET_NAME_SLOT=</varname> <replaceable > prefix</replaceable> [<constant > P</constant> <replaceable > domain</replaceable> ]<constant > s</constant> <replaceable > slot</replaceable> [<constant > f</constant> <replaceable > function</replaceable> ][<constant > n</constant> <replaceable > port_name</replaceable> |<constant > d</constant> <replaceable > dev_port</replaceable> ]</term>
<term > <varname > ID_NET_NAME_SLOT=</varname> <replaceable > prefix</replaceable> <constant > v</constant> <replaceable > slot</replaceable> </term>
<term > <varname > ID_NET_NAME_SLOT=</varname> <replaceable > prefix</replaceable> <constant > x</constant> <replaceable > slot</replaceable> </term>
<term > <varname > ID_NET_NAME_SLOT=</varname> <replaceable > prefix</replaceable> [<constant > P</constant> <replaceable > domain</replaceable> ]<constant > s</constant> <replaceable > slot</replaceable> [<constant > f</constant> <replaceable > function</replaceable> ][<constant > n</constant> <replaceable > port_name</replaceable> |<constant > d</constant> <replaceable > dev_port</replaceable> ]<constant > b</constant> <replaceable > number</replaceable> </term>
<term > <varname > ID_NET_NAME_SLOT=</varname> <replaceable > prefix</replaceable> [<constant > P</constant> <replaceable > domain</replaceable> ]<constant > s</constant> <replaceable > slot</replaceable> [<constant > f</constant> <replaceable > function</replaceable> ][<constant > n</constant> <replaceable > port_name</replaceable> |<constant > d</constant> <replaceable > dev_port</replaceable> ]<constant > u</constant> <replaceable > port</replaceable> …[<constant > c</constant> <replaceable > config</replaceable> ][<constant > i</constant> <replaceable > interface</replaceable> ]</term>
<term > <varname > ID_NET_NAME_SLOT=</varname> <replaceable > prefix</replaceable> [<constant > P</constant> <replaceable > domain</replaceable> ]<constant > s</constant> <replaceable > slot</replaceable> [<constant > f</constant> <replaceable > function</replaceable> ][<constant > n</constant> <replaceable > port_name</replaceable> |<constant > d</constant> <replaceable > dev_port</replaceable> ]<constant > v</constant> <replaceable > slot</replaceable> </term>
<term > <varname > ID_NET_NAME_SLOT=</varname> <replaceable > prefix</replaceable> [<constant > P</constant> <replaceable > domain</replaceable> ]<constant > s</constant> <replaceable > slot</replaceable> [<constant > f</constant> <replaceable > function</replaceable> ][<constant > n</constant> <replaceable > port_name</replaceable> |<constant > d</constant> <replaceable > dev_port</replaceable> ]<constant > r</constant> <replaceable > slot</replaceable> </term>
2019-05-09 13:34:30 +03:00
<listitem > <para > This property describes the slot position. Different schemes are used depending on
2020-01-07 20:02:15 +03:00
the bus type, as described in the table below. In case of USB, BCMA, and SR-VIO devices, the full
name consists of the prefix, PCI slot identifier, and USB or BCMA or SR-VIO slot identifier. The
first two parts are denoted as "…" in the table below.</para>
2019-05-09 13:34:30 +03:00
<table >
<title > Slot naming schemes</title>
<tgroup cols= '2' >
<thead >
<row >
<entry > Format</entry>
<entry > Description</entry>
</row>
</thead>
<tbody >
<row >
<entry > <replaceable > prefix</replaceable> [<constant > P</constant> <replaceable > domain</replaceable> ] <constant > s</constant> <replaceable > slot</replaceable> [<constant > f</constant> <replaceable > function</replaceable> ] [<constant > n</constant> <replaceable > port_name</replaceable> | <constant > d</constant> <replaceable > dev_port</replaceable> ]</entry>
<entry > PCI slot number</entry>
</row>
2020-01-07 20:02:15 +03:00
<row >
<entry > <replaceable > prefix</replaceable> <constant > v</constant> <replaceable > slot</replaceable> </entry>
<entry > VIO slot number (IBM PowerVM)</entry>
</row>
2021-10-20 07:18:59 +03:00
<row >
<entry > <replaceable > prefix</replaceable> <constant > X</constant> <replaceable > number</replaceable> </entry>
<entry > VIF interface number (Xen)</entry>
</row>
2019-05-09 13:34:30 +03:00
<row >
<entry > … <constant > b</constant> <replaceable > number</replaceable> </entry>
<entry > Broadcom bus (BCMA) core number</entry>
</row>
<row >
<entry > … <constant > u</constant> <replaceable > port</replaceable> … [<constant > c</constant> <replaceable > config</replaceable> ] [<constant > i</constant> <replaceable > interface</replaceable> ]</entry>
<entry > USB port number chain</entry>
</row>
<row >
<entry > … <constant > v</constant> <replaceable > slot</replaceable> </entry>
<entry > SR-VIO slot number</entry>
</row>
2023-06-22 11:06:27 +03:00
<row >
<entry > … <constant > r</constant> <replaceable > slot</replaceable> </entry>
<entry > SR-IOV slot number</entry>
</row>
2019-05-09 13:34:30 +03:00
</tbody>
</tgroup>
</table>
<para > The PCI domain is only prepended when it is not 0. All multi-function PCI devices will carry
2023-12-23 18:04:11 +03:00
the <constant > f</constant> <replaceable > function</replaceable> number in the device name, including
2019-05-09 13:34:30 +03:00
the function 0 device. For non-multi-function devices, the number is suppressed if 0. The port name
<replaceable > port_name</replaceable> is used, or the port number
<constant > d</constant> <replaceable > dev_port</replaceable> if the name is not known.</para>
<para > For BCMA devices, the core number is suppressed when 0.</para>
<para > For USB devices the full chain of port numbers of hubs is composed. If the name gets longer
than the maximum number of 15 characters, the name is not exported. The usual USB configuration
number 1 and interface number 0 values are suppressed.</para>
<para > SR-IOV virtual devices are named based on the name of the parent interface, with a suffix of
<constant > v</constant> and the virtual device number, with any leading zeros removed. The bus
2020-01-07 20:02:15 +03:00
number is ignored.</para>
2020-10-19 12:10:31 +03:00
2023-06-22 11:06:27 +03:00
<para > SR-IOV virtual device representors are named based on the name of the physical device
interface, with a suffix of <constant > r</constant> and the number of the virtual device that
is linked to the particular representor, with any leading zeros removed. The physical port
name and the bus number are ignored.</para>
2020-10-19 12:10:31 +03:00
<para > In some configurations a parent PCI bridge of a given network controller may be associated
with a slot. In such case we don't generate this device property to avoid possible naming conflicts.</para>
2023-09-18 18:03:38 +03:00
<xi:include href= "version-info.xml" xpointer= "v243" />
2020-01-07 20:02:15 +03:00
</listitem>
2019-05-09 13:34:30 +03:00
</varlistentry>
<varlistentry >
2023-12-24 12:39:08 +03:00
<term > <varname > ID_NET_NAME_PATH=</varname> <replaceable > prefix</replaceable> <constant > c</constant> <replaceable > bus_id</replaceable> </term>
<term > <varname > ID_NET_NAME_PATH=</varname> <replaceable > prefix</replaceable> <constant > a</constant> <replaceable > vendor</replaceable> <replaceable > model</replaceable> <constant > i</constant> <replaceable > instance</replaceable> </term>
<term > <varname > ID_NET_NAME_PATH=</varname> <replaceable > prefix</replaceable> <constant > i</constant> <replaceable > address</replaceable> <constant > n</constant> <replaceable > port_name</replaceable> </term>
<term > <varname > ID_NET_NAME_PATH=</varname> <replaceable > prefix</replaceable> <constant > u</constant> <replaceable > port</replaceable> …</term>
<term > <varname > ID_NET_NAME_PATH=</varname> <replaceable > prefix</replaceable> [<constant > P</constant> <replaceable > domain</replaceable> ]<constant > p</constant> <replaceable > bus</replaceable> <constant > s</constant> <replaceable > slot</replaceable> [<constant > f</constant> <replaceable > function</replaceable> ][<constant > n</constant> <replaceable > phys_port_name</replaceable> |<constant > d</constant> <replaceable > dev_port</replaceable> ]</term>
<term > <varname > ID_NET_NAME_PATH=</varname> <replaceable > prefix</replaceable> [<constant > P</constant> <replaceable > domain</replaceable> ]<constant > p</constant> <replaceable > bus</replaceable> <constant > s</constant> <replaceable > slot</replaceable> [<constant > f</constant> <replaceable > function</replaceable> ][<constant > n</constant> <replaceable > phys_port_name</replaceable> |<constant > d</constant> <replaceable > dev_port</replaceable> ]<constant > b</constant> <replaceable > number</replaceable> </term>
<term > <varname > ID_NET_NAME_PATH=</varname> <replaceable > prefix</replaceable> [<constant > P</constant> <replaceable > domain</replaceable> ]<constant > p</constant> <replaceable > bus</replaceable> <constant > s</constant> <replaceable > slot</replaceable> [<constant > f</constant> <replaceable > function</replaceable> ][<constant > n</constant> <replaceable > phys_port_name</replaceable> |<constant > d</constant> <replaceable > dev_port</replaceable> ]<constant > u</constant> <replaceable > port</replaceable> …[<constant > c</constant> <replaceable > config</replaceable> ][<constant > i</constant> <replaceable > interface</replaceable> ]</term>
2019-05-09 13:34:30 +03:00
<listitem > <para > This property describes the device installation location. Different schemes are
used depending on the bus type, as described in the table below. For BCMA and USB devices, PCI path
information must known, and the full name consists of the prefix, PCI slot identifier, and USB or
BCMA location. The first two parts are denoted as "…" in the table below.</para>
<table >
<title > Path naming schemes</title>
<tgroup cols= '2' >
<thead >
<row >
<entry > Format</entry>
<entry > Description</entry>
</row>
</thead>
<tbody >
<row >
<entry > <replaceable > prefix</replaceable> <constant > c</constant> <replaceable > bus_id</replaceable> </entry>
<entry > CCW or grouped CCW device identifier</entry>
</row>
<row >
<entry > <replaceable > prefix</replaceable> <constant > a</constant> <replaceable > vendor</replaceable> <replaceable > model</replaceable> <constant > i</constant> <replaceable > instance</replaceable> </entry>
<entry > ACPI path names for ARM64 platform devices</entry>
</row>
<row >
<entry > <replaceable > prefix</replaceable> <constant > i</constant> <replaceable > address</replaceable> <constant > n</constant> <replaceable > port_name</replaceable> </entry>
<entry > Netdevsim (simulated networking device) device number and port name</entry>
</row>
<row >
<entry > <replaceable > prefix</replaceable> [<constant > P</constant> <replaceable > domain</replaceable> ] <constant > p</constant> <replaceable > bus</replaceable> <constant > s</constant> <replaceable > slot</replaceable> [<constant > f</constant> <replaceable > function</replaceable> ] [<constant > n</constant> <replaceable > phys_port_name</replaceable> | <constant > d</constant> <replaceable > dev_port</replaceable> ]</entry>
<entry > PCI geographical location</entry>
</row>
<row >
<entry > … <constant > b</constant> <replaceable > number</replaceable> </entry>
<entry > Broadcom bus (BCMA) core number</entry>
</row>
<row >
<entry > … <constant > u</constant> <replaceable > port</replaceable> … [<constant > c</constant> <replaceable > config</replaceable> ] [<constant > i</constant> <replaceable > interface</replaceable> ]</entry>
<entry > USB port number chain</entry>
</row>
</tbody>
</tgroup>
</table>
<para > CCW and grouped CCW devices are found in IBM System Z mainframes. Any leading zeros and
dots are suppressed.</para>
<para > For PCI, BCMA, and USB devices, the same rules as described above for slot naming are
used.</para>
2023-09-18 18:03:38 +03:00
<xi:include href= "version-info.xml" xpointer= "v243" />
2019-05-09 13:34:30 +03:00
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 >
<title > History</title>
2020-10-22 15:03:57 +03:00
<para > The following "naming schemes" have been defined (which may be chosen at system boot-up time via
2021-01-28 22:38:27 +03:00
the <varname > net.naming-scheme=</varname> kernel command line switch, see above):</para>
2019-05-09 13:34:30 +03:00
<variablelist >
<varlistentry >
<term > <constant > v238</constant> </term>
2023-08-22 19:52:36 +03:00
<listitem > <para > This is the naming scheme that was implemented in systemd 238.</para>
<xi:include href= "version-info.xml" xpointer= "v243" /> </listitem>
2019-05-09 13:34:30 +03:00
</varlistentry>
<varlistentry >
<term > <constant > v239</constant> </term>
<listitem > <para > Naming was changed for virtual network interfaces created with SR-IOV and NPAR and
for devices where the PCI network controller device does not have a slot number associated.</para>
<para > SR-IOV virtual devices are named based on the name of the parent interface, with a suffix of
<literal > v<replaceable > port</replaceable> </literal> , where <replaceable > port</replaceable> is the
virtual device number. Previously those virtual devices were named as if completely independent.
</para>
<para > The ninth and later NPAR virtual devices are named following the scheme used for the first
eight NPAR partitions. Previously those devices were not renamed and the kernel default
("eth<replaceable > N</replaceable> ") was used.</para>
<para > Names are also generated for PCI devices where the PCI network controller device does not
have an associated slot number itself, but one of its parents does. Previously those devices were
not renamed and the kernel default was used.</para>
2023-08-22 19:52:36 +03:00
<xi:include href= "version-info.xml" xpointer= "v243" />
2019-05-09 13:34:30 +03:00
</listitem>
</varlistentry>
<varlistentry >
<term > <constant > v240</constant> </term>
2019-06-17 10:21:57 +03:00
<listitem > <para > The <literal > ib</literal> prefix and stable names for infiniband devices are
2019-05-09 13:34:30 +03:00
introduced. Previously those devices were not renamed.</para>
<para > The ACPI index field (used in <varname > ID_NET_NAME_ONBOARD=</varname> ) is now also used when
0.</para>
<para > A new naming policy <varname > NamePolicy=keep</varname> was introduced. With this policy, if
the network device name was already set by userspace, the device will not be renamed
again. Previously, this naming policy applied implicitly, and now it must be explicitly
requested. Effectively, this means that network devices will be renamed according to the
configuration, even if they have been renamed already, if <constant > keep</constant> is not
2019-11-21 22:22:12 +03:00
specified as the naming policy in the <filename index= "false" > .link</filename> file. See
2019-05-09 13:34:30 +03:00
<citerefentry > <refentrytitle > systemd.link</refentrytitle> <manvolnum > 5</manvolnum> </citerefentry>
2023-08-22 19:52:36 +03:00
for a description of <varname > NamePolicy=</varname> .</para>
<xi:include href= "version-info.xml" xpointer= "v243" /> </listitem>
2019-05-09 13:34:30 +03:00
</varlistentry>
2019-06-17 10:42:46 +03:00
<varlistentry >
<term > <constant > v241</constant> </term>
<listitem > <para > <option > MACAddressPolicy=persistent</option> was extended to set MAC addresses
based on the device name. Previously addresses were only based on the
2019-11-21 22:22:12 +03:00
<varname index= "false" > ID_NET_NAME_*</varname> attributes, which meant that interface names would
2019-06-17 10:42:46 +03:00
never be generated for virtual devices. Now a persistent address will be generated for most
devices, including in particular bridges.</para>
<para > Note: when userspace does not set a MAC address for a bridge device, the kernel will
initially assign a random address, and then change it when the first device is enslaved to the
bridge. With this naming policy change, bridges get a persistent MAC address based on the bridge
2023-08-22 19:52:36 +03:00
name instead of the first enslaved device.</para>
<xi:include href= "version-info.xml" xpointer= "v243" /> </listitem>
2019-06-17 10:42:46 +03:00
</varlistentry>
2019-05-09 13:34:30 +03:00
<varlistentry >
<term > <constant > v243</constant> </term>
2019-06-17 10:21:57 +03:00
<listitem > <para > Support for renaming netdevsim (simulated networking) devices was added. Previously
those devices were not renamed.</para>
2019-05-09 13:41:52 +03:00
<para > Previously two-letter interface type prefix was prepended to
2023-08-22 19:52:36 +03:00
<varname > ID_NET_LABEL_ONBOARD=</varname> . This is not done anymore.</para>
<xi:include href= "version-info.xml" xpointer= "v243" /> </listitem>
2019-05-09 13:34:30 +03:00
</varlistentry>
2019-06-24 01:24:18 +03:00
<varlistentry >
<term > <constant > v245</constant> </term>
<listitem > <para > When
<citerefentry > <refentrytitle > systemd-nspawn</refentrytitle> <manvolnum > 1</manvolnum> </citerefentry>
derives the name for the host side of the network interface created with
<option > --network-veth</option> from the container name it previously simply truncated the result
at 15 characters if longer (since that's the maximum length for network interface names). From now
on, for any interface name that would be longer than 15 characters the last 4 characters are set to
a 24bit hash value of the full interface name. This way network interface name collisions between
multiple similarly named containers (who only differ in container name suffix) should be less
2023-08-22 19:52:36 +03:00
likely (but still possible, since the 24bit hash value is very small).</para>
<xi:include href= "version-info.xml" xpointer= "v245" /> </listitem>
2019-06-24 01:24:18 +03:00
</varlistentry>
2020-10-19 12:10:31 +03:00
<varlistentry >
2020-10-22 15:03:57 +03:00
<term > <constant > v247</constant> </term>
2020-10-19 12:10:31 +03:00
2021-01-28 22:38:27 +03:00
<listitem > <para > When a PCI slot is associated with a PCI bridge that has multiple child network
controllers, the same value of the <varname > ID_NET_NAME_SLOT</varname> property might be derived
for those controllers. This would cause a naming conflict if the property is selected as the device
name. Now, we detect this situation and don't produce the <varname > ID_NET_NAME_SLOT</varname>
2023-08-22 19:52:36 +03:00
property.</para>
<xi:include href= "version-info.xml" xpointer= "v247" /> </listitem>
2020-10-19 12:10:31 +03:00
</varlistentry>
udev: fix slot based network names on s390
The s390 PCI driver assigns the hotplug slot name from the
function_id attribute of the PCI device using a 8 char hexadecimal
format to match the underlying firmware/hypervisor notation.
Further, there's always a one-to-one mapping between a PCI
function and a hotplug slot, as individual functions can
hot plugged even for multi-function devices.
As the generic matching code will always try to parse the slot
name in /sys/bus/pci/slots as a positive decimal number, either
a wrong value might be produced for ID_NET_NAME_SLOT if
the slot name consists of decimal numbers only, or none at all
if a character in the range from 'a' to 'f' is encountered.
Additionally, the generic code assumes that two interfaces
share a hotplug slot, if they differ only in the function part
of the PCI address. E.g., for an interface with the PCI address
dddd:bb:aa.f, it will match the device to the first slot with
an address dddd:bb:aa. As more than one slot may have this address
for the s390 PCI driver, the wrong slot may be selected.
To resolve this we're adding a new naming schema version with the
flag NAMING_SLOT_FUNCTION_ID, which enables the correct matching
of hotplug slots if the device has an attribute named function_id.
The ID_NET_NAME_SLOT property will only be produced if there's
a file /sys/bus/pci/slots/<slotname> where <slotname> matches
the value of /sys/bus/pci/devices/.../function_id in 8 char
hex notation.
Fixes #19016
See also #19078
2021-03-18 13:03:34 +03:00
<varlistentry >
<term > <constant > v249</constant> </term>
<listitem > <para > PCI hotplug slot names for the s390 PCI driver are a hexadecimal representation
of the <filename > function_id</filename> device attribute. This attribute is now used to build the
<varname > ID_NET_NAME_SLOT</varname> . Before that, all slot names were parsed as decimal
numbers, which could either result in an incorrect value of the <varname > ID_NET_NAME_SLOT</varname>
2021-04-27 16:25:16 +03:00
property or none at all.</para>
2023-05-17 13:24:04 +03:00
<para > Some firmware and hypervisor implementations report unreasonably high numbers for the
2023-11-06 16:59:00 +03:00
on-board index. To prevent the generation of bogus on-board interface names, index numbers greater
2023-05-17 13:24:04 +03:00
than 16381 (2¹⁴-1) were ignored. For s390 PCI devices index values up to 65535 (2¹⁶-1) are valid.
To account for that, the limit was increased to 65535.</para>
2021-06-25 15:56:53 +03:00
<para > The udev rule <varname > NAME=</varname> replaces <literal > :</literal> ,
<literal > /</literal> , and <literal > %</literal> with an underscore (<literal > _</literal> ), and
refuses strings which contain only numerics.</para>
2023-08-22 19:52:36 +03:00
<xi:include href= "version-info.xml" xpointer= "v249" />
2021-06-25 15:56:53 +03:00
</listitem>
udev: fix slot based network names on s390
The s390 PCI driver assigns the hotplug slot name from the
function_id attribute of the PCI device using a 8 char hexadecimal
format to match the underlying firmware/hypervisor notation.
Further, there's always a one-to-one mapping between a PCI
function and a hotplug slot, as individual functions can
hot plugged even for multi-function devices.
As the generic matching code will always try to parse the slot
name in /sys/bus/pci/slots as a positive decimal number, either
a wrong value might be produced for ID_NET_NAME_SLOT if
the slot name consists of decimal numbers only, or none at all
if a character in the range from 'a' to 'f' is encountered.
Additionally, the generic code assumes that two interfaces
share a hotplug slot, if they differ only in the function part
of the PCI address. E.g., for an interface with the PCI address
dddd:bb:aa.f, it will match the device to the first slot with
an address dddd:bb:aa. As more than one slot may have this address
for the s390 PCI driver, the wrong slot may be selected.
To resolve this we're adding a new naming schema version with the
flag NAMING_SLOT_FUNCTION_ID, which enables the correct matching
of hotplug slots if the device has an attribute named function_id.
The ID_NET_NAME_SLOT property will only be produced if there's
a file /sys/bus/pci/slots/<slotname> where <slotname> matches
the value of /sys/bus/pci/devices/.../function_id in 8 char
hex notation.
Fixes #19016
See also #19078
2021-03-18 13:03:34 +03:00
</varlistentry>
2021-10-20 07:18:59 +03:00
<varlistentry >
<term > <constant > v250</constant> </term>
<listitem > <para > Added naming scheme for Xen netfront "vif" interfaces based on the guest side
VIF number set from the Xen config (or the interface index in AWS EC2).</para>
2023-08-22 19:52:36 +03:00
<xi:include href= "version-info.xml" xpointer= "v250" />
2021-10-20 07:18:59 +03:00
</listitem>
</varlistentry>
2022-03-23 19:34:12 +03:00
<varlistentry >
<term > <constant > v251</constant> </term>
<listitem > <para > Since version <constant > v247</constant> we no longer set
<varname > ID_NET_NAME_SLOT</varname> if we detect that a PCI device associated with a slot is a PCI
bridge as that would create naming conflict when there are more child devices on that bridge. Now,
this is relaxed and we will use slot information to generate the name based on it but only if
the PCI device has multiple functions. This is safe because distinct function number is a part of
the device name for multifunction devices.</para>
2023-08-22 19:52:36 +03:00
<xi:include href= "version-info.xml" xpointer= "v251" />
2022-03-23 19:34:12 +03:00
</listitem>
</varlistentry>
udev: net_id: Use devicetree aliases when available
Devicetree firmware contains an "aliases" node, containing various
aliases for devices described by the firmware. For ethernet devices,
these are named "ethernet0", "ethernet1", etc. They provide a convenient
means of numbering ethernet devices, especially on systems with no other
stable number other than the address. In particular, U-Boot already uses
these aliases to name its ethernet devices.
Previously, there have been attempts (such as [1]) to add support for
these aliases to Linux. However, these patches have been rejected
because it is the maintainers' view that naming policy be left to
userspace. Well, systemd is userspace, so here we are.
In terms of implementation, apparently there can be multiple device
trees at once. I have decided to dodge this problem for now, and just
use /proc/device-tree. If it is desired to support multiple device trees
later, then the scheme can be modified to include the device tree's
index. For example, /sys/firmware/devicetree/base2/aliases/ethernet3
might be named enb2d3.
For the moment we only support "ethernetX" aliases. Future patches might
want to also handle "canX" and "wifiX".
It is common on boards with only one ethernet device to use an alias of
just "ethernet". In this case, the index is an implicit 0. In case the
author of the firmware made a mistake, we check to ensure that aliases
of "ethernet" and "ethernet0" do not both exist.
[1] https://patchwork.kernel.org/project/linux-arm-kernel/patch/1399390594-1409-1-git-send-email-boris.brezillon@free-electrons.com/
Closes: #17625
2022-08-09 20:38:26 +03:00
<varlistentry >
<term > <constant > v252</constant> </term>
<listitem > <para > Added naming scheme for platform devices with devicetree aliases.</para>
2023-08-22 19:52:36 +03:00
<xi:include href= "version-info.xml" xpointer= "v252" />
udev: net_id: Use devicetree aliases when available
Devicetree firmware contains an "aliases" node, containing various
aliases for devices described by the firmware. For ethernet devices,
these are named "ethernet0", "ethernet1", etc. They provide a convenient
means of numbering ethernet devices, especially on systems with no other
stable number other than the address. In particular, U-Boot already uses
these aliases to name its ethernet devices.
Previously, there have been attempts (such as [1]) to add support for
these aliases to Linux. However, these patches have been rejected
because it is the maintainers' view that naming policy be left to
userspace. Well, systemd is userspace, so here we are.
In terms of implementation, apparently there can be multiple device
trees at once. I have decided to dodge this problem for now, and just
use /proc/device-tree. If it is desired to support multiple device trees
later, then the scheme can be modified to include the device tree's
index. For example, /sys/firmware/devicetree/base2/aliases/ethernet3
might be named enb2d3.
For the moment we only support "ethernetX" aliases. Future patches might
want to also handle "canX" and "wifiX".
It is common on boards with only one ethernet device to use an alias of
just "ethernet". In this case, the index is an implicit 0. In case the
author of the firmware made a mistake, we check to ensure that aliases
of "ethernet" and "ethernet0" do not both exist.
[1] https://patchwork.kernel.org/project/linux-arm-kernel/patch/1399390594-1409-1-git-send-email-boris.brezillon@free-electrons.com/
Closes: #17625
2022-08-09 20:38:26 +03:00
</listitem>
</varlistentry>
2022-10-10 23:30:10 +03:00
<varlistentry >
<term > <constant > v253</constant> </term>
<listitem > <para > Set <varname > ID_NET_NAME_PATH</varname> for usb devices not connected via a PCI bus.</para>
2023-08-22 19:52:36 +03:00
<xi:include href= "version-info.xml" xpointer= "v253" />
2022-10-10 23:30:10 +03:00
</listitem>
</varlistentry>
2023-06-22 11:06:27 +03:00
<varlistentry >
<term > <constant > v254</constant> </term>
2023-10-16 12:54:21 +03:00
<listitem > <para > Naming was changed for SR-IOV virtual device representors, optionally settable at
compilation time. The <literal > r<replaceable > slot</replaceable> </literal> suffix was added to
differentiate SR-IOV virtual device representors attached to a single physical device interface.
Because of a mistake, this scheme was <emphasis > not the the default scheme for systemd version
254</emphasis> .</para>
2023-06-22 11:06:27 +03:00
2023-10-16 12:54:21 +03:00
<xi:include href= "version-info.xml" xpointer= "v255" />
</listitem>
</varlistentry>
<varlistentry >
<term > <constant > v255</constant> </term>
<listitem > <para > Naming was changed for SR-IOV virtual device representors to enable the
change introduced in <constant > v254</constant> by default.</para>
2023-08-22 19:52:36 +03:00
2023-10-16 12:54:21 +03:00
<xi:include href= "version-info.xml" xpointer= "v255" />
2023-06-22 11:06:27 +03:00
</listitem>
</varlistentry>
2019-06-24 01:24:18 +03:00
</variablelist>
2019-06-17 10:21:57 +03:00
<para > Note that <constant > latest</constant> may be used to denote the latest scheme known (to this
2020-07-06 11:49:59 +03:00
particular version of systemd).</para>
2019-05-09 13:34:30 +03:00
</refsect1>
2023-12-08 14:33:06 +03:00
<refsect1 >
<title > Limiting the use of specific sysfs attributes</title>
<para > When creating names for network cards, some naming schemes use data from sysfs populated
by the kernel. This means that although a specific naming scheme in udev is picked,
the network card's name can still change when a new kernel version adds a new sysfs attribute.
For example if kernel starts setting the <constant > phys_port_name</constant> , udev will append the
"<constant > n</constant> <replaceable > phys_port_name</replaceable> " suffix to the device name.</para>
<variablelist >
<varlistentry >
2023-12-24 12:39:08 +03:00
<term > <varname > ID_NET_NAME_ALLOW=</varname> <replaceable > BOOL</replaceable> </term>
2023-12-08 14:33:06 +03:00
2023-12-20 09:08:49 +03:00
<listitem > <para > This udev property sets a fallback policy for reading a sysfs attribute.
2023-12-08 14:33:06 +03:00
If set to <constant > 0</constant> udev will not read any sysfs attribute by default, unless it is
explicitly allowlisted, see below. If set to <constant > 1</constant> udev can use any sysfs attribute
unless it is explicitly forbidden. The default value is <constant > 1</constant> .</para>
<xi:include href= "version-info.xml" xpointer= "v256" />
</listitem>
</varlistentry>
<varlistentry >
<term > <varname > ID_NET_NAME_ALLOW_<replaceable > sysfsattr</replaceable> =<replaceable > BOOL</replaceable> </varname> </term>
2023-12-20 09:08:49 +03:00
<listitem > <para > This udev property explicitly states if udev shall use the specified
2023-12-08 14:33:06 +03:00
<replaceable > sysfsattr</replaceable> , when composing the device name.</para>
<xi:include href= "version-info.xml" xpointer= "v256" />
</listitem>
</varlistentry>
</variablelist>
<para > With these options, users can set an allowlist or denylist for sysfs attributes. To create
an allowlist, the user needs to set <varname > ID_NET_NAME_ALLOW=0</varname> for the device and then list
the allowed attributes with the
<varname > ID_NET_NAME_ALLOW_<replaceable > sysfsattr</replaceable> =1</varname>
options. In case of a denylist, the user needs to provide the list of denied attributes with
the <varname > ID_NET_NAME_ALLOW_<replaceable > sysfsattr</replaceable> =0</varname> options.</para>
</refsect1>
2019-05-09 13:34:30 +03:00
<refsect1 >
<title > Examples</title>
<example >
<title > Using <command > udevadm test-builtin</command> to display device properties</title>
<programlisting > $ udevadm test-builtin net_id /sys/class/net/enp0s31f6
...
Using default interface naming scheme 'v243'.
ID_NET_NAMING_SCHEME=v243
ID_NET_NAME_MAC=enx54ee75cb1dc0
ID_OUI_FROM_DATABASE=Wistron InfoComm(Kunshan)Co.,Ltd.
ID_NET_NAME_PATH=enp0s31f6
...</programlisting>
</example>
<example >
<title > PCI Ethernet card with firmware index "1"</title>
<programlisting > ID_NET_NAME_ONBOARD=eno1
2019-05-09 13:41:52 +03:00
ID_NET_NAME_ONBOARD_LABEL=Ethernet Port 1
2019-05-09 13:34:30 +03:00
</programlisting>
</example>
<example >
<title > PCI Ethernet card in hotplug slot with firmware index number</title>
<programlisting > # /sys/devices/pci0000:00/0000:00:1c.3/0000:05:00.0/net/ens1
ID_NET_NAME_MAC=enx000000000466
ID_NET_NAME_PATH=enp5s0
ID_NET_NAME_SLOT=ens1</programlisting>
</example>
<example >
<title > PCI Ethernet multi-function card with 2 ports</title>
<programlisting > # /sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/enp2s0f0
ID_NET_NAME_MAC=enx78e7d1ea46da
ID_NET_NAME_PATH=enp2s0f0
# /sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.1/net/enp2s0f1
ID_NET_NAME_MAC=enx78e7d1ea46dc
ID_NET_NAME_PATH=enp2s0f1</programlisting>
</example>
<example >
<title > PCI WLAN card</title>
<programlisting > # /sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlp3s0
ID_NET_NAME_MAC=wlx0024d7e31130
ID_NET_NAME_PATH=wlp3s0</programlisting>
</example>
<example >
<title > PCI IB host adapter with 2 ports</title>
<programlisting > # /sys/devices/pci0000:00/0000:00:03.0/0000:15:00.0/net/ibp21s0f0
ID_NET_NAME_PATH=ibp21s0f0
# /sys/devices/pci0000:00/0000:00:03.0/0000:15:00.1/net/ibp21s0f1
ID_NET_NAME_PATH=ibp21s0f1</programlisting>
</example>
<example >
<title > USB built-in 3G modem</title>
<programlisting > # /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.4/2-1.4:1.6/net/wwp0s29u1u4i6
ID_NET_NAME_MAC=wwx028037ec0200
ID_NET_NAME_PATH=wwp0s29u1u4i6</programlisting>
</example>
<example >
<title > USB Android phone</title>
<programlisting > # /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/net/enp0s29u1u2
ID_NET_NAME_MAC=enxd626b3450fb5
ID_NET_NAME_PATH=enp0s29u1u2</programlisting>
</example>
<example >
<title > s390 grouped CCW interface</title>
<programlisting > # /sys/devices/css0/0.0.0007/0.0.f5f0/group_device/net/encf5f0
ID_NET_NAME_MAC=enx026d3c00000a
ID_NET_NAME_PATH=encf5f0</programlisting>
</example>
2023-12-08 14:33:06 +03:00
<example >
<title > Set an allowlist for reading sysfs attributes for network card naming</title>
<programlisting > <filename > /etc/udev/hwdb.d/50-net-naming-allowlist.hwdb</filename>
net:naming:drvirtio_net:*
ID_NET_NAME_ALLOW=0
ID_NET_NAME_ALLOW_ACPI_INDEX=1
ID_NET_NAME_ALLOW_ADDR_ASSIGN_TYPE=1
ID_NET_NAME_ALLOW_ADDRESS=1
ID_NET_NAME_ALLOW_ARI_ENABLED=1
ID_NET_NAME_ALLOW_DEV_PORT=1
ID_NET_NAME_ALLOW_FUNCTION_ID=1
ID_NET_NAME_ALLOW_IFLINK=1
ID_NET_NAME_ALLOW_INDEX=1
ID_NET_NAME_ALLOW_LABEL=1
ID_NET_NAME_ALLOW_PHYS_PORT_NAME=1
ID_NET_NAME_ALLOW_TYPE=1</programlisting>
</example>
<example >
<title > Set a denylist so that specified sysfs attribute are ignored</title>
<programlisting > <filename > /etc/udev/hwdb.d/50-net-naming-denylist.hwdb</filename>
net:naming:drvirtio_net:*
ID_NET_NAME_ALLOW=1
ID_NET_NAME_ALLOW_DEV_PORT=0
ID_NET_NAME_ALLOW_PHYS_PORT_NAME=0
</programlisting>
</example>
2019-05-09 13:34:30 +03:00
</refsect1>
<refsect1 >
<title > See Also</title>
2023-12-22 21:09:32 +03:00
<para > <simplelist type= "inline" >
<member > <citerefentry > <refentrytitle > udev</refentrytitle> <manvolnum > 7</manvolnum> </citerefentry> </member>
<member > <citerefentry > <refentrytitle > udevadm</refentrytitle> <manvolnum > 8</manvolnum> </citerefentry> </member>
<member > <ulink url= "https://systemd.io/PREDICTABLE_INTERFACE_NAMES" > Predictable Network Interface Names</ulink> </member>
<member > <citerefentry > <refentrytitle > systemd-nspawn</refentrytitle> <manvolnum > 1</manvolnum> </citerefentry> </member>
</simplelist> </para>
2019-05-09 13:34:30 +03:00
</refsect1>
</refentry>