Renaming your NICs
Due to the new kernel recognizing more features of some hardware, like for example virtual functions, and interface naming often derives from the PCI(e) address, some NIC may change their name, in which case the network configuration needs to be adapted.
To assign a name to a particular network device, you need a way to uniquely and permanently identify that device in the [Match] section.
One possibility is to match the device’s MAC address using the MAC Address option, as it is unlikely to change.
Change the Name of a NIC
Due to the new kernel recognizing more features of some hardware, like for example virtual functions, and interface naming often derives from the PCI(e) address, some NIC may change their name, in which case the network configuration needs to be adapted.
In general, it's recommended to either have an independent remote connection to the Proxmox Backup Server's host console, for example, through IPMI or iKVM, or physical access for managing the server even when its own network doesn't come up after a major upgrade or network change.
The latest version of Proxmox Backup Server 3.4 and 4.0 provide a package called proxmox-network-interface-pinning that you can install. This package offers a CLI tool that helps you pin all network interfaces to NIC-based names and update the network configuration simultaneously.
Proxmox VE don't write changes directly to /etc/network/interfaces.
Instead, we write into a temporary file called /etc/network/interfaces.new. This way, many changes can be done at once. And, you may make sure your changes are correct, before applying them.
It works by reading the existing link files and looking up interfaces with the corresponding MAC address. If pins have already been applied, this would return a mapping of the pinned name to itself (nic0 ⇒ nic0).
How to use Pinning
USAGE: pve-network-interface-pinning <COMMAND> [ARGS] [OPTIONS]
pve-network-interface-pinning generate [OPTIONS]
pve-network-interface-pinning help [<extra-args>] [OPTIONS]Issue the command pve-network-interface-pinning generate to rename all your Ethernet ports to stable nic1, nic2 ...
root@pve-1:~# proxmox-network-interface-pinning generate
This will generate name pinning configuration for all interfaces - continue (y/N)?
y
Name for link 'enp0s18' will change to 'nic0'
Name for link 'enp0s19' will change to 'nic1'
Name for link 'enp0s20' will change to 'nic2'
Name for link 'enp0s21' will change to 'nic3'
Name for link 'enp0s22' will change to 'nic4'
Generating link files
Successfully generated .link files in '/usr/local/lib/systemd/network/'
Updating /etc/pve/nodes/pve-1/host.fw.new
Updating /etc/network/interfaces.new
Updating /etc/pve/sdn/controllers.cfg
Updating /etc/pve/sdn/fabrics.cfg
Successfully updated Proxmox VE configuration files.
Please reboot to apply the changes to your configurationOverride the default prefix
You can override the default prefix with the --prefix flag:
pve-network-interface-pinning generate --prefix myprefixPin only a specific interface
It is also possible to pin only a specific interface:
pve-network-interface-pinning generate --interface enp1s0When pinning a specific interface, you can specify the exact name that the interface should be pinned to:
pve-network-interface-pinning generate --interface enp3s0 --target-name wan41
pve-network-interface-pinning generate --interface enp2s0 --target-name lan41
Use the new config
You need to reboot your server for the changes to take effect
systemctl rebootAfter the reboot /etc/network/interfaces looks like this
auto lo
iface lo inet loopback
iface lan41 inet manual
iface wan41 inet manual
iface wlan inet manual
auto vmbr1
iface vmbr1 inet static
address 192.168.100.41/24
gateway 192.168.100.1
bridge-ports lan41
bridge-stp off
bridge-fd 0
bridge-vlan-aware yes
bridge-vids 2-4094
#LAN 1
auto vmbr0
iface vmbr0 inet manual
bridge-ports wan41
bridge-stp off
bridge-fd 0
bridge-vlan-aware yes
bridge-vids 2-4094
#WAN 100If you try to pin a pinned NIC
An error will be shown:
There already exists a pin for NIC 'eno1' - aborting.
Created files
They are stored in /usr/local/lib/systemd/network as link files with name 50-pve-<pnined_name>.link
Updated files
/etc/pve/nodes/pve-1/host.fw.new/etc/network/interfaces.new/etc/pve/sdn/con
References
NIC pinning [1]