Add a new nic card, ip link shows the old nic name changed, but /etc/network/interfaces still uses old name.

prolab

New Member
Aug 11, 2020
21
2
3
My motherboard originally only have one RJ45 network port. After installed Proxmox VE, ip link shows its name was enp5s0.

Then later I added a new pci-e network card with two SFP+ ports. Then I found I can't access the Proxmox VE server's management interface through the old port. Since it's running as a server without monitors connected, I have to connect a keyboard and monitor to it to figure out why. Then I found after added the new card, ip link shows the old port's name has changed to enp6s0 (the two new nic names are ens6 and ens6d1). But /etc/network/interfaces still uses the old name enp5s0 which does not exist anymore. After changed the name, the problem is resolved.

This causes a bit of trouble and if the added pci-e card fails someday the nic name may be changed back. So I'm wondering can we let /etc/network/interfaces automatically detect and change its name? Or can we use something fixed like MAC address so we do not need to worry about the name changes anymore?
 
/etc/network/interfaces is a static configuration file, it would be a bad idea to auto-update it. In theory, the "predictable" systemd network names shouldn't change anyway, that's more a side-effect of hardware being quirky and only barely holding together at all.

You can however assign a custom name to a network interface, matched by MAC address (or several other properties). See here for more, example configuration:

Code:
# cat /etc/systemd/network/10-onboard.link
[Match]
MACAddress=xx:xx:xx:xx:xx:xx
[Link]
Name=customname0

You'd have to change 'enp6s0' to 'customname0' in /etc/network/interfaces, but from then it shouldn't change again.
 

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!