How to enable "Predictable Network Interface Names"?

I decided to check out what name my ethernet device will end up with, but contrary to other distros, Debian doesn’t seem to have activated this change (or is holding it back?),

  • Keep the old persistent network interface naming scheme for now and make
    the new one opt-in via net.ifnames=1 on the kernel command line.

The problem is that I have to edit the grub kernel lines, and that seems like overkill for something that can be disabled by modifying a file. Is there another way?

Asked By: Braiam


I assume you’re talking about sid or jessie. For wheezy you may want to try the backport of v204.

There may be some misconceptions in play here: as can be seen from the udev rules here (for v208 currently in sid), the udev developers explicitly chose the kernel cmdline as the default way of enabling this functionality.
I don’t see anything inherently “overkill” with using the chosen interface for it and simply putting GRUB_CMDLINE_LINUX_DEFAULT="net.ifnames=1" in /etc/default/grub. Is there any specific side-effect you’re worried about?

The fact that the answer you mentioned suggests removing a file to disable it is a hack (at least in Debian’s case) that wouldn’t work in the long-term because in debian those rules are stored in /lib/udev/rules.d, i.e.: they would get overwritten in an upgrade (besides, disabling functionality by effectively removing the file that describes it makes some sense, but enabling it is fundamentally different, so I think this is an unfair comparison).

OTOH, if you have a concrete reason for not using the kernel cmdline, you could report a bug against the debian package and have the maintainer move these rules to /etc/udev/. Then you could theoretically switch between the current “persistent” and the new “predictable” rules.

But just FYI: looking at the sources for version 209, it seems to get rid of the net.if_names check altogether, so your question may need some readdressing in the near future.

Answered By: Leo Antunes

Ubuntu 15.10 uses biosdevname which doesn’t provide predictable network interface names. Even if you remove it (apt-get remove biosdevname) and
edit grub (GRUB_CMDLINE_LINUX_DEFAULT="net.ifnames=1") and the persistent rules, you still don’t get predicatble network interaces.

The main reason seems to be backward compatibility. I tested it just now with 2 mobile broadband USB devices and the network interface name is inconsistently named on each boot(e.g. the first interface usb0, second usb1 and the other way around).The main reason seems to be backward compatibility.

There are some bugs open on launchpad(e.g. this) but the short answer is that if you are looking for predictable network interface names you should look for a different distro.

Answered By: Anthony Hunt

Version 220-7 on Debian dropped the patch that made this opt-in:

* Switch to net.ifnames persistent network interfaces (on new
  installations/for new hardware), and deprecate the old

This came about from a proposal in debian-devel list. Systems which were using the old naming won’t be renamed until the user migrates. Read README.Debian for the migration guide.

The new name can be predicted by using:

sudo udevadm test /sys/class/net/eth0 2>/dev/null |grep ID_NET_NAME_

where eth0 is the current name of the device.

Answered By: Braiam

On Debian/Ubuntu, starting with udev 220, you can enable the new names by renaming this file:

sudo mv -T /etc/udev/rules.d/70-persistent-net.rules{,.old}

As suggested by /usr/share/doc/udev/README.Debian.gz, followed by

sudo update-initramfs -u

Then rebooting (or rmmod+insmod of the module driving your network card).

Answered By: Tobu
Categories: Answers Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.