Ubuntu – Network interface name changes after update to 15.10 – udev changes


I updated a virtual machine running Ubuntu server 15.04 to the just released new stable 15.10.

There were no apparent problems, but after reboot the machine lost its network connection. lspci showed the correct card and lsmod proved that the driver had been loaded.

Hints about editing or removing /etc/udev/rules.d/70-persistent-net.rules did not succeed (still no network, no new file), the famous /lib/udev/write_net_rules did not even exist.

I don't have much clue regarding udev and systemd, so it took me some time to find in /sys/class/net that the network interface name changed. It became ens32, which was renamed from eth0. After I changed /etc/network/interfaces network communication was enabled again.

But – why does this happen at all? And if it happens, shouldn't the interfaces file be updated automatically?

Now that I deleted the virtual network card and created another one, eth0 becomes eno16777728, which is not so, uhm, nice.

Should this behaviour (at least that of the upgrade procedure) be reported as a bug?

Furthermore, is /etc/udev/rules.d/70-persistent-net.rules obsolete now? And (although only partly related) what about /etc/udev/rules.d/70-persistent-cd.rules?)

Edit – additional question (after accepted answer)
The dependency of /etc/network/interfaces from the actual interface name bothered me. I tried a new installation of *ubuntu in another virtual machine. To my surprise, /etc/network/interfaces contained a reference to the loopback device only. However, with my original VM this change prevented the network to come up. So what else do I need to change?

Well, from another test I found that a new Ubuntu Server has the network interface card in /etc/network/interfaces, while XUbuntu has not. Maybe it is using network-manager or something else.

Best Answer

  • In Ubuntu 15.10 (Wily Werewolf), starting with systemd/udev will automatically assign predictable, stable network interface names for all local Ethernet, Wlan and Wwan interfaces (source).

    The following different naming schemes for network interfaces are now supported by udev natively:

    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) - deprecated

    By default, systemd will now name interfaces following policy:

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

    How do you disable this?

    You basically have the following options:

    • Create your own manual naming scheme, for example by naming your interfaces internet0, or lan0. For that create your own udev rules file and set the name property for the devices. Make sure to order it before the default policy file, for example by naming it /etc/udev/rules.d/70-my-net-names.rules
    • Alter the default policy file, for picking a different naming scheme, for example for naming all interface names after their MAC address by default: cp /lib/udev/rules.d/80-net-setup-link.rules /etc/udev/rules.d/80-net-setup-link.rules, then edit the file there and change the lines as necessary.
    • Pass the net.ifnames=0 on the kernel command line.
  • Related Question