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?

Edit 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.

  • The same bug appears again in 17.04. Hope only during pre-release stage. – avtomaton Mar 12 '17 at 22:30
up vote 55 down vote accepted

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.
  • 6
    Is this the source? Can you add a link to the official release note page for Ubuntu (I am sure it's somewhere, can't find it!) – Rmano Oct 26 '15 at 19:31
  • 2
    Yes, this is the source. – kyodake Oct 26 '15 at 21:15
  • 3
    What doesn't make sense at all is that he did an upgrade, not a fresh install. This sounds like an actual Ubuntu bug, because the upgrade should leave the system in a working state. – Will Dec 10 '15 at 0:27
  • 1
    @kyodake there is no /usr/lib/udev folder in ubuntu 15.10, there is /lib/udev – EdiD Jan 16 '16 at 11:02
  • 1
    @EdiD: ok, bug fixed. – kyodake Jan 16 '16 at 15:10

There is an easier way told by the ArchWiki Beginnersguide.

First get your devices MAC Address by

$ ip link

The output show by like

3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000     
          link/ether 20:68:9d:xx:xx:xx brd ff:ff:ff:ff:ff:ff

Your devices MAC address is the

20:68:9d:xx:xx:xx

Just create the file (simply open with sudo rights in a text editor)

$ nano /etc/udev/rules.d/10-network.rules    

Add following line

SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="aa:bb:cc:dd:ee:ff", NAME="net1"

Replace name with your wanted name and aa:bb:cc:dd:ee:ff with your devices MAC address.

Now just reboot your computer and the device name should have changed.

  • The most direct and simple solution! Massive Thanks! – 3bdalla Dec 27 '16 at 9:38
  • To ensure the rule does NOT apply to your vlan and bridge interfaces add DRIVERS=="?*", after ACTION=="add",. See also askubuntu.com/questions/767786/… – Donn Lee May 17 at 23:30

Try this: Edit your /etc/default/grub. Change the line from

GRUB_CMDLINE_LINUX=""

to

GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"

and, finally run:

# update-grub

as root, and reboot your system.

  • This also works for netboot. I had success adding the following to the append statement in my syslinux.cfg file: append (...) net.ifnames=0 (...) – carestad Jun 16 '16 at 12:39
  • This solutions works perfect in Ubuntu 16.04 as well! – Nullldata Jul 7 '16 at 15:53
  • I had to add the GRUB parameters above (net.ifnames=0) and remove the udev renaming rules to get vlans to work, but now everything is fine. Thanks for the solution. – Albert Veli Jan 13 '17 at 10:19
  • THANK YOU. I am installing Ubuntu Server 16.04 on a headless server and had no idea what name it was giving the network interface and, as a result, the server wasn't on the network. I did this and made sure /etc/network/interfaces had "eth0" as the interface name and put the drive back in the server. It is now online. Instructions for installing Ubuntu on the Acer Aspire H340 are out of date as far as this is concerned, so I'll be writing something up in the hope that others trying the same won't waste as much time as I did. – MetalMikester Jun 10 '17 at 12:19

I know this may be a little late and the adding of the 10-network.rules seems to have helped but not completely. I had to add the kernel name of the device to rename. Here's how I got the /etc/udev/rules.d/10-network.rules to work...

SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="MAC:ADDRESS",KERNEL=="enp4s8", NAME="eth0"

and change the KERNEL=="" to what your kernel is naming the device when it boots.

HTH

K.C.

If you have a fresh install

apt-get remove biosdevname

Then

update-initramfs -u

Check to see if you have udev net ruels file. If so, remove it.

rm /etc/udev/rules.d/70-persistent-net.rules

Now edit /etc/network/interfaces, rename the interfaces to eth0, eth1, ...etc.

Reboot

I got this working by creating file:

root@odroid:~# cat /etc/udev/rules.d/70-persistent-net.rules
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth0", NAME="eth0"

protected by Community Feb 9 '17 at 23:09

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.