The Joys of Spontaneous Network Interface Renaming

jebbam

Well-Known Member
Sep 8, 2019
64
21
48
Once upon a time Linux network interface names followed the unpredictable pattern: eth0, eth1, eth2, eth3, eth4, eth5.

With the advent of the miraculous systemd and "Predictable Network Interface Names" they have a variety of names. On one cluster I have, with six+ interfaces on each node, the interfaces have had all of these names over the years, presumably inspired by pwgen: eth0, eth1, eth2, eth3, eth4, eth5, eth6, eth7, ens5f0, ens5f1, eno1, eno2, ens5f0, ens5f1, ens5f2, ens5f3, ens5f0np0, ens5f1np1, ens5f2np2, eno1np0, eno2np1, enp5s0f0, enp4s0f1, enp4s0f0, enp5s0f1, enp4s0f3, enp4s0f2, enp2s0f1, enp2s0f0, ens1f0, ens1f1, ens1f2, ens1f3, enp113s0f0np0, enp113s0f1np1, enp199s0f0np0, enp199s0f1np1, enp101s0f0, enp101s0f1, enp101s0f2, enp101s0f3, enp181s0f0, enp181s0f1, ens9f0, ens9f1, enp23s0f0, enp23s0f1, enp23s0f2, enp23s0f3, and enxbe3af2b6059f.

What predictable name will they have tomorrow?

One way to have great fun is to update a system, reboot, and realize the network interface interface names have changed. Yay! Best is if you're using dropbear for encrypted root and can't even unlock the drives without getting IPMI going on a system across the globe. The cherry on top is if the IPMI requires an ancient java applet that only works with 10+ year old java. Hopefully the ISP hasn't changed the VPN to the IPMI! Such are the joys of sorting out a dead network due to renaming.

The best way to avoid this is to set up static names for each of the interfaces based on their MAC addresses. It is in the Proxmox documentation here:

https://pve.proxmox.com/pve-docs/pve-admin-guide.html#network_override_device_names

In sum, do something like this, *on a working system*. Get the network interface names and MAC addresses, skipping "lo" and your "vmbrN" interfaces:

Code:
ip a

For each interface, create a new file here, typically using the interface name. So, for example, from this `ip a` snippet:

Code:
2: ens5f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9000 qdisc mq master vmbr1 state UP group default qlen 1000
    link/ether e8:ea:6a:27:c5:cd brd ff:ff:ff:ff:ff:ff

Edit `/etc/systemd/network/10-ens5f0.link` and add:

Code:
[Match]
MACAddress=e8:ea:6a:27:c5:cd
Type=ether

[Link]
Name=ens5f0

Do this for every ethernet interface you don't want to break.

Then run this so it works after rebooting:

Code:
sudo update-initramfs -u -k all

This has been biting Linux and Proxmox users for years.
(cf. https://forum.proxmox.com/threads/p...rk-card-and-can-not-use-it.56690/#post-266253 ).

**Perhaps Proxmox could automagically set up these files when creating a new node and spare folks these pleasures.**
 
Last edited:
I too been stung by this. From what I understand Debian won't do this again for a long time. To me it's better to let the changes happen and then fix the interfaces so they start working again using the new naming scheme. Lucky for me at work I use iDrac9 so it's easy to go in and fix the /etc/interface files.
 
From what I understand Debian won't do this again for a long time.

It just happened today to me.

To me it's better to let the changes happen and then fix the interfaces so they start working again using the new naming scheme

This is what I thought the first time it happened. "Oh, I'll just adapt to the new way, guess I just gotta learn!" Then they changed again. And again. And again.

This morning, upgrading from Proxmox 8.1 to Proxmox 8.2... Not even a major upgrade. The difference was the upgrade moved from Linux kernel 6.5 to kernel 6.8. This changed interfaces "eno1" to "eno1np0" and "eno2" to "eno2np1".

So you can go in and "fix" it each time, but it is assuredly going to break again.

And for people that haven't been through this, as can be seen *all over this forum*, they can be down for hours while they figure out what is up.

I just think it should "work by default". Proxmox can just write a file when setting up the interfaces to begin with. It would save a lot of users pain. I just set up 76 interfaces to not break...

Even using something like iDrac9 has overhead. You should just be able to reboot and have a working system... "Don't break userspace" or somesuch, I once read.
 
  • Like
Reactions: esi_y
Here's a crufty scriptlet to automatically generate these files. It outputs them to /tmp, then you can copy to /etc/systemd/network if they look correct. I tested it on a few different systems, running Debian and Proxmox and it worked fine.

Bash:
#!/bin/bash

OUTDIR=/tmp

for ETH in `ls -1 /sys/class/net/ | sort -V | grep -v -e "^bond"  -e "^fwbr" -e "^fwln" -e "fwpr" -e "^lo$" -e "^tap" -e "^vmbr"`
    do echo "-------------------------"
       echo "[Match]" > ${OUTDIR}/10-${ETH}.link
       echo -n "MACAddress=" >> ${OUTDIR}/10-${ETH}.link
       ip link show dev ${ETH} | grep "link/ether" | awk '{print $2}' >> ${OUTDIR}/10-${ETH}.link
       echo "Type=ether" >> ${OUTDIR}/10-${ETH}.link
       echo "" >> ${OUTDIR}/10-${ETH}.link
       echo "[Link]" >> ${OUTDIR}/10-${ETH}.link
       echo "Name=${ETH}" >> ${OUTDIR}/10-${ETH}.link
       cat ${OUTDIR}/10-${ETH}.link
done
echo "-------------------------"

After copying them into /etc/systemd/network, be sure to then run this:

Bash:
sudo update-initramfs -u -k all
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!