Migrating to UID-based network interface names

Adapt a network configuration for RoCE Express PCI functions to the predictable network-interface naming-scheme.

Goal

After a Linux® upgrade, adapt an existing network configuration with RoCE Express to a new interface naming-scheme, see Network interface names.

Assumptions

Before the kernel upgrade, a RoCE Express based network interface has the name enP4272p0s0. NetworkManager, the network manager of the distribution, uses this name for a connection con1. The corresponding PCI function has the function address 10b0:00:00.0 and function ID 3e1.

Strategy

Compute the predictable interface name and configure it alongside the existing interface before the kernel upgrade.

Sample procedure

Unless your distribution offers a migration tool that can handle changed network interface names, proceed according to the steps that follow.

  1. Find out whether UID uniqueness checking is enabled in the environment where your Linux instance runs.
    Read the uid_is_unique attribute for the PCI function in the pci branch of sysfs.
    # cat /sys/bus/pci/devices/10b0:00:00.0/uid_is_unique
    1
    The predictable interface name depends on this information.
    1
    UID uniqueness checking is enabled. The interface name is based on the UID.
    1. Read the UID from sysfs.
      # cat /sys/bus/pci/devices/10b0:00:00.0/uid
      0x10b0
    2. Convert the hexadecimal value into a decimal number: 0x10b0 = 4272. This decimal number is also used in enP4272p0s0. This match is common but not guaranteed. Always compute the decimal number.
    3. The network interface name is the eno prefix followed by UID in decimal notation: eno4272.
    0
    UID uniqueness checking not enabled. The interface name is based on the FID.
    1. Read the FID from sysfs.
      # cat /sys/bus/pci/devices/10b0:00:00.0/function_id
      0x03e1
    2. Convert the hexadecimal value into a decimal number: 0x03e1 = 993.
    3. The network interface name is the ens prefix followed by FID in decimal notation: ens993.
    The following steps assume that UID uniqueness checking is enabled and so the interface name is eno4272.
  2. Proceed according to how you are connected to the Linux instance.
    • If you are connected through a connection other than con1 for enP4272p0s0, modify con1 to use eno4272.

      Modifying a connection is disruptive, so it must not be busy. In particular, do not modify a connection while using it for a login session. Issue an nmcli command to modify the connection.

      # nmcli connection modify con1 connection.interface-name eno4272
    • If you are connected through connection con1 for enP4272p0s0, issue a nmcli command to add a connection for eno4272.
      # nmcli connection add con2 connection.interface-name eno4272 ...
      See the nmcli man page for further options.

      Change any specifications that use the connection name of the existing connection for interface name enP4272p0s0 to use the name of the newly created connection for eno4272. For example, the old connection name might be used as part of custom scripts for system automation.

    Change any specifications, for example in custom scripts, to use the new interface name eno4272 instead of the former enP4272p0s0.

  3. When the upgraded Linux instance is booted, the connection for eno4272 is used.
    You can use the ip command to confirm that the interface with the new name is active.
    # ip a 
    1: lo: ...
       ...
    2: eno4272: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 
       link/ether 82:11:a1:b9:82:06 brd ff:ff:ff:ff:ff:ff 
       altname ens993 
       altname enP4272p0s0 
       ...
    The output might include lines that begin with altname and specify the interface name according to other naming schemes. Although Linux can detect the mapping, do not rely on any network manager to use this information for automatically accommodating changed interface names.
  4. If you have created a new connection for the new interface name, you can now delete the old connection.