Proxmox: How To Rename Network Interfaces

The nano and reboot commands documented below must be ran as root

Adding or changing your hardware configuration may result in network interface names changing, leading to unexpected networking issues for your server and virtual machines. But this issue can be easily avoided by simply renaming your network interface(s).

Since setting up my Proxmox server, I have had two experiences where adding new hardware devices resulted in my main network interface name changing. The first time this occurred was when I added a pair of NVMe drives, resulting in the interface’s name changing from enp4s0 to enp5s0. And today, when I added an additional ethernet PCIe card, it again changed the interface’s name, this time from enp5s0 to enp6s0.

In both instances, the vmbr0 Linux bridge that Proxmox created no longer pointed to the correct interface, requiring me to update /etc/network/interfaces and point it to newly updated interface name. Until the change was made, I did not have network access to Proxmox, and was forced to make the change directly on the server via the console.

Renaming a network interface on Debian is not difficult, and only requires updating one file. But since Proxmox creates the vmbr0 Linux bridge, a second file will also need updating.

Researching Network Interfaces

The first thing we need to do is find the MAC address of the network interface we want to rename. Run the following command:

root@pve:~# ip addr show

And look for the network interface your are wanting to rename. In my case, I want to rename the network interface tied to vmbr0, so the entry I am interested in is:

5: vmbr0:  mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 7f:f7:11:b1:8c:75 brd ff:ff:ff:ff:ff:ff
    inet 10.0.10.10/24 scope global vmbr0
       valid_lft forever preferred_lft forever

On the second line of the entry, directly following the label link/ether is the MAC address (in my case, it is 7f:f7:11:b1:8c:75). Write down the MAC address you see on your screen as it will be used in the next step.

Renaming the Network Interface

Now we need to update /etc/udev/rules.d/70-persistent-net.rules:

root@pve:~# nano /etc/udev/rules.d/70-persistent-net.rules

And add the following line to the file (plugging in your variables):

# interface with MAC address "MAC Address" will be assigned "Interface Name"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="MAC Address ", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="enp*", NAME="Interface Name "

In my case, I plugged in the MAC address 7f:f7:11:b1:8c:75, and used the name ethmain.

# interface with MAC address "7f:f7:11:b1:8c:75" will be assigned "ethmain"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="7f:f7:11:b1:8c:75", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="enp*", NAME="ethmain"

After making the change, save the file and exit back to the command line. If the interface name you changed isn’t associated with the vmbr0 Linux bridge, then jump to the Apply and Validate section. Otherwise, continue on to the next section.

Updating Proxmox’s Bridge

If the interface name you changed is associated with the vmbr0 Linux bridge, then you need to make one more change. Open /etc/network/interfaces:

root@pve:~# nano /etc/network/interfaces

And update the bridge-ports line to reflect the new interface name:

iface vmbr0 inet static
        address 10.0.10.10/24
        gateway 10.0.10.1
        bridge-ports ethmain
        bridge-stp off
        bridge-fd 0

After making the change, save the file and exit back to the command line.

Apply and Validate

Now all that is left to do is apply the changes, and validate that they took. To do so, first reboot Proxmox:

root@pve:~# reboot -h now

Once booted up, run the following from the console to see if the network interface rename was successful:

root@pve:~# ip addr show

After a quick scan, I was able to see that the interface name took, and that a reference to the altname was also presented:

3: ethmain:  mtu 1500 qdisc pfifo_fast master vmbr0 state UP group default qlen 1000
    link/ether 7f:f7:11:b1:8c:75 brd ff:ff:ff:ff:ff:ff
    altname enp6s0

If all went well, you should now have the comfort of knowing that a future hardware change won’t throw your network interfaces into a whirlwind of unexpected trouble.