Skip to content

Custom Interface Names

Linux (debian) has a 15 character limit for interface names.
The prox debian, by default is configured in perdictable interface name mode, which can often provide interface names with 10's of characters.
The minute you start appending VLAN IDs (e.g. enp26s0f2np2.303) you are now over that limit, so the interface cannot be brought online.

Fixing interface names

The below is how it was addressed on jnb1srvdscocssmngpuprx223

Warning

This will require a system reboot. Moving active VMs off is recommended.

1. Current interface details

You need to get the interface/s current name and mac address.
This can be done using a simple ip a

Example

The interfaces to change on jnb1srvdscocssmngpuprx223 looked like

.
.
5: enp26s0f2np2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9000 qdisc mq state UP mode DEFAULT group default qlen 1000
    link/ether 7c:c2:55:b8:a4:ba brd ff:ff:ff:ff:ff:ff
6: enp26s0f3np3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9000 qdisc mq state UP mode DEFAULT group default qlen 1000
    link/ether 7c:c2:55:b8:a4:bb brd ff:ff:ff:ff:ff:ff
.
.

Thus:
- iSCSI A Interface (#5): we have a name of enp26s0f2np2 and a mac address of 7c:c2:55:b8:a4:ba - ISCSI B Interface (#6): we have a name of enp26s0f3np3 and a mac address of `7c:c2:55

2. UDEV file

We now need to create the aliases for the interfaces.

OLD VERSION

Create/edit the file /etc/udev/rules.d/10-interface-custom-names.rules (it can be called anything, just make sure that alphabetically it is higher up than any other network related files in the/etc/udev/rules.d/ directory).

Add the following contents (and update the mac addresses according to what you want (and names, if required))

SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="7c:c2:55:b8:a4:ba", NAME="iscsia"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="7c:c2:55:b8:a4:bb", NAME="iscsib"

NEW VERSION

We now need to create seperate link files for each interface with a custom name e.g. /etc/systemd/network/10-iscsi.link and /etc/systemd/network/11-iscsi.link

Add the following contents (and update the mac addresses according to what you want (and names, if required))

[Match]
MACAddress=7C:C2:55:B8:A4:BA

[Link]
Name=iscsia

Information

Use capital letter for the mac address in the link files

3. Interfaces File

Make a backup of the interfaces file first cp /etc/network/interfaces /root/interfaces.bkp

Change each interface entry from the old name to the new name. Can be done easilty with VI/VIM

  1. vim /etc/network/interfaces
  2. Inside vim, type :%s/<OLD_NAME>/<NEW_NAME>/g (e.g :%s/enp26s0f3np3/iscsib/g)
  3. Repeat this process for each interface.

4. Apply udev changes

udevadm control --reload
udevadm trigger

5. Reboot server

You will now need to reboot the server to apply the changes

init 6

6. Test

Log back into the server test 1. Check ip a output for new names (and if they are online) 2. Try ping a known target on each network (at least one target should work per interface)