I’m currently doing a Proxmox lab with an old PC of mine, which has a RJ45 NIC on board and a 2-port PCIe card.
Proxmox/Debian uses a predictable naming scheme which is derived from the hardware location of the interface, which can look a little cryptic.
My PCIe NIC has the physical ports labeled LNK A
and LNK B
so I wanted to have similar interface names.
Keep in mind that this is for home labbing, future changes in Proxmox might be incompatible. This is what works for me currently:
get existing MAC addresses
With ip -br l
show the current NICs with MAC addresses. Mine looked something like this:
root@proxmox:/root# ip -br l
lo UNKNOWN 00:00:00:00:00:00 <LOOPBACK,UP,LOWER_UP>
eno0 UP 00:00:00:11:11:11 <BROADCAST,MULTICAST,UP,LOWER_UP>
enp34s0 DOWN 00:00:00:44:44:44 <BROADCAST,MULTICAST>
enp33s0f1 DOWN 00:00:00:66:66:66 <BROADCAST,MULTICAST>
vmbr0 UP 00:00:00:00:00:01 <BROADCAST,MULTICAST,UP,LOWER_UP>
I really didn’t like the names enp34s0
and enp33s0f1
that’s why I searched for a solution.
My new custom naming scheme
Not sure if this is a bug, but Proxmox shows interfaces as Unknown
and not editable when it doesn’t start with en
. So that’s why I have every interface start with en_
-
NIC on mainboard
- en_lnk_main
-
PCIe NIC Port A
- en_lnk_a
-
PCIe NIC Port B
- en_lnk_b
Set custom schemes with .LINK files
As described here in the Debian wiki it’s possible to use .link
to specify custom names. For this I created 3 files in /etc/systemd/network
root@proxmox:/etc/systemd/network# ls
00-en_lnk_main.link 10-en_lnk_a.link 20-en_lnk_b.link
00-en_lnk_main
[Match]
MACAddress=00:00:00:11:11:11
[Link]
Name=en_lnk_main
10-en_lnk_a
[Match]
MACAddress=00:00:00:44:44:44
[Link]
Name=en_lnk_a
20-en_lnk_b
[Match]
MACAddress=00:00:00:66:66:66
[Link]
Name=en_lnk_b
Apply changes for regular network configuration
If you skip this step before rebooting, you’ll most likely lose network access!
Now you must change the names in the actual configuration. Replace it with the names you chose in the previous step. Be careful not to forget the interface reference for your bridge-ports
.
/etc/network/interfaces
|
|
For this example I replaced the values on line 15, 17, 19 and 25.
There are different ways to apply the settings without reboot, some are listed at the previously mentioned Debian Wiki, but I usually prefer a clean reboot, just to test if everything works as expected.
Now my inner Monk is happy how this looks 🤓