Making Network Interface Names Persistent in Proxmox

Aman Ullah Juman
3 min readOct 7, 2024

--

When making changes to PCI devices in Proxmox, such as adding or replacing network adapters, it’s common for the system to change the network interface names (e.g., eth0, eth1). This can lead to confusion and broken network configurations. To ensure persistent naming, we can leverage udev rules or configure systemd settings. This guide walks you through different methods to achieve this.

Why Persistent Names?

  • Consistent device names across reboots and hardware changes.
  • Prevent misconfiguration of network services.
  • Simplify management in virtualized environments like Proxmox.

Method 1: Use udev Rules for Persistent Naming

udev is the device manager for the Linux kernel. By creating custom rules, you can enforce consistent naming for network interfaces based on their MAC addresses.

Step-by-Step Instructions:

1. Identify Current Network Interfaces

First, find the MAC addresses of your current network interfaces:

ip link

You’ll see output similar to:

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether 12:34:56:78:9a:bc brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether 98:76:54:32:10:fe brd ff:ff:ff:ff:ff:ff

Note down the MAC addresses (12:34:56:78:9a:bc, etc.) for later.

2. Create a Custom udev Rule File

To enforce the interface names, create a new udev rule file:

nano /etc/udev/rules.d/70-persistent-net.rules

3. Define the Rules

Add rules for each network interface using their MAC addresses:

SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="12:34:56:78:9a:bc", NAME="eth0"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="98:76:54:32:10:fe", NAME="eth1"

Replace ATTR{address} with the MAC address you noted, and set the desired NAME for the interface.

4. Reload udev Rules and Restart Networking

Reload the udev rules:

udevadm control --reload-rules

You may also need to restart networking or reboot the server to apply the changes:

systemctl restart networking

Method 2: Disable Predictable Network Interface Names

Predictable network interface names (like enp0s3) can sometimes be confusing or undesirable. You can disable these and revert to the classic naming convention (eth0, eth1).

Step-by-Step Instructions:

1. Edit Grub Configuration

Open the /etc/default/grub file:

nano /etc/default/grub

2. Disable Predictable Names

Locate the GRUB_CMDLINE_LINUX line and add net.ifnames=0 biosdevname=0:

GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"

3. Update Grub

Save the file and update grub to apply the changes:

update-grub

4. Reboot the Server

Reboot the server for the changes to take effect:

reboot

Method 3: Use Systemd .link Files for Persistent Naming

If your system uses systemd, you can configure persistent naming through .link files.

Step-by-Step Instructions:

1. Create a Link File

Create a new link file in /etc/systemd/network/:

nano /etc/systemd/network/10-persistent-name.link

2. Configure the Link File

Add configuration to specify the interface name based on the MAC address:

[Match]
MACAddress=12:34:56:78:9a:bc

[Link]
Name=eth0

Repeat this configuration for each interface, changing the MACAddress and Name values accordingly.

3. Reload Systemd and Restart Networking

Reload systemd and restart networking to apply the changes:

systemctl restart systemd-networkd

Summary

Ensuring that your network interfaces have persistent names in Proxmox helps prevent confusion, especially when changing hardware or adding new PCI devices. Here are the key methods:

  • udev Rules: Create custom rules to enforce naming based on MAC addresses.
  • Disable Predictable Names: Modify grub to disable the predictable naming scheme.
  • Systemd .link Files: Use link files to configure network interface names.

Choose the approach that best suits your environment. For most users, using udev rules provides a reliable and easy-to-understand method for maintaining consistency across reboots and hardware changes.

--

--

No responses yet