4

I spent a lot of time to correctly rename the network interfaces to Debian 11, since I had to collect information in fact bit by bit, I decided to create this question.

Task: Rename ens86f[0-3] to eth1p[1-4]. So that these interfaces are perceived as native by the system and there are no problems associated with an undiscovered interface (of course, you will need to change the existing static configs, but only once and for all)

1 Answer 1

6

All that is needed for this, as it turned out, is to create a file /etc/systemd/network/10-eth1p1.link with the following contents: (The "10" in the interface name is important, don't touch it if you don't understand why)

# ex. name: ens86f0
[Match]
MACAddress=aa:bb:cc:dd:ee:ff
[Link]
Name=eth1p1

More information here: https://manpages.debian.org/testing/udev/systemd.link.5.en.html

To take the MAC interface, type ip link and there will be something like this:

7: ens86f1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 1000
    link/ether aa:bb:cc:dd:ee:ff brd ff:ff:ff:ff:ff:ff
    altname enp202s0f1

Accordingly, this is our mac: link/ether aa:bb:cc:dd:ee:ff

In the Name section, you specify what you want - this will be the name of your interface

Accordingly, for other interfaces, we create a similar file (1 interface = 1 file):

ens86f1 -> /etc/systemd/network/10-eth1p2.link
ens86f2 -> /etc/systemd/network/10-eth1p3.link
ens86f3 -> /etc/systemd/network/10-eth1p4.link

Now you need to restart the computer (I have not found a way to update the names without restarting, if you know, please write in the comments)

GO BACK

In order to return the original name to the interface, you will need to delete or comment out the contents of the file of the desired interface and reboot

P.s.: No, systemd-networkd.service is disabled

Perhaps some of these services are responsible for renaming:

  • systemd-udevd.service
  • systemd-udevd-control.socket
  • systemd-udevd-kernel.socket
  • systemd-udev-trigger.service

P.s.s.: I renamed the interfaces after an empty debian installation, only NetworkManager was installed from a non-standard one

2
  • This works great - I prefer it over using rename lines in /etc/network/interfaces for Debian.
    – LawrenceC
    Dec 10, 2023 at 14:13
  • 1
    Great question/answer ! to change a nic name instantly, just ip link set ens86f1 name eth1p2 as can be seen in Serverfault question 910406. But anyway it makes sense to reboot just to make sure everything works as expected.
    – exore
    Dec 27, 2023 at 18:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .