If the firmware of the system provides a PCI Express hotplug slot number for the NIC, you'll see a ensX
name. If the firmware claims the NIC is integrated to the system board, you'll see a enoX
name. Otherwise, for any PCI/PCI-X/PCIExpress NIC, a enpXsY
style name will be used.
Note that in enpXsY
, the numbers X and Y will directly reflect the NIC's PCI Bus ID (enpXsY
for X:Y.0, enpXsYfZ
for X:Y.Z when Z != 0), although the NIC names use decimal numbers while PCI bus IDs are hexadecimal. For example, enp0s29f6
is PCI ID 0:1d.6.
With udevadm info -q all -p /sys/class/net/<interface name> | grep ID_NET_NAME_
, you can view all the auto-detected name candidates for a network interface.
If the system firmware does not provide a physical slot numbering, then the ensX
names will simply not be available. You could create completely custom NIC names using the same naming format, but you should not do that without a very good reason.
In modern Debian, you can assign a custom name to a network interface using a /etc/systemd/network/*.link
file. Such a file needs to have two sections: a [Match]
section containing the rules to determine which NIC this file should apply to (see man systemd.link
for details), and a [Link]
section overriding the standard naming policy and specifying a custom name.
For example, I have a 4G "portable WiFi access point" which apparently changes its MAC address every time it's powered on, maybe to provide some privacy. To stop it from creating a new network interface every time it was connected by USB (using the rndis_host
driver... sigh) I created a *.link
file to give it a persistent name using the device's USB-readable serial number, like this
[Match]
Driver=rndis_host
Property=ID_SERIAL_SHORT=<serial number here>
[Link]
Description=A very private 4G AP.
NamePolicy=
Name=myAP
When using the Name=
line to specify a custom NIC name, you must also set NamePolicy=
to an empty string to override the system standard NamePolicy which would otherwise produce an auto-generated name.