Persistent network interface names in Ubuntu 15.10 & later

ubuntu_logo_81x81One of the changes introduced in Ubuntu Wily Werewolf is persistent stateless names. It means your network interfaces in ifconfig output will no longer follow the ethX pattern. This solves major problems with predictability of an interface name on Ubuntu if you have multiple cards. This applies to ethernet, WLAN and WWAN interfaces.

This originally started off due to Dell devices and SLES has defaulted to the nomenclature earlier. It’s nice to see Ubuntu adopting the same too. Both udev and systemd are involved in this change.

The udev naming convention follows different schemes:

  1. Names incorporating Firmware/BIOS provided index numbers for on-board devices (example: eno1)
  2. Names incorporating Firmware/BIOS provided PCI Express hotplug slot index numbers (example: ens1)
  3. Names incorporating physical/geographical location of the connector of the hardware (example: enp2s0)
  4. Names incorporating the interfaces’s MAC address (example: enx78e7d1ea46da)
  5. Classic, unpredictable kernel-native ethX naming (example: eth0) – depreciated

systemd naming convention will use the same convention from above in the below order:

  1. if that information from the firmware is applicable and available
  2. if that information from the firmware is applicable and available
  3. if applicable
  4. in all other cases
  5. is not used by default, but is available if the user chooses so

It’s unlikely this will bother you. However, if you want to fallback to the older nomenclature, you need to make some changes in udev:

  1. Get your MAC address:
    $ ifconfig
    // OR
    $ ip link
  2. Create /etc/udev/rules.d/10-network.rules and add the following line:
    SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="aa:bb:cc:dd:ee:ff", NAME="eth1"

    Replace the last field with the name you want.

  3. Append the following kernel parameter (within quotes like the other options) to the line starting with GRUB_CMDLINE_LINUX_DEFAULT= in /etc/default/grub:
  4. Run:
    $ sudo update-grub2
  5. Reboot

Leave a Reply

Your email address will not be published. Required fields are marked *