Use of Predictable Network Interface Names with alternate kernels
You need to distinguish between 3 things:
- Predictable interfaces names
- biosdevname
- 70-persistent.rules udev rule
You either choose to use one of these solution but you don't use 2 or 3 at the same time. (In fact, you can but one will take precedence and mask the other(s))
A good introduction to the current situation is the post on the ubuntu dev mailing list
Predictable interface names
Predictable interface names is a udevd thing since v197 generated in /lib/udev/rules.d/80-net-setup-link.rules
systemd use by default the new predictable interface name. However, unless upstream systemd, in Ubuntu, you have to opt-in by using net.ifnames=1
It does not matter the kernel version you are running. But you need to use the kernel command line to configure it by changing grub configuration /etc/default/grub
, like:
GRUB_CMDLINE_LINUX_DEFAULT="net.ifnames=1"
and run
sudo update-grub
In 14.04 or 14.10, without systemd, it should be enough to remove 70-persitent-net.rules, as described below in the note.
Biosdevname
biosdevname is a dell attempt to solve a similar problem than predictable interface name in systemd. It is the default on ubuntu server. You can have it by installing the package biosdevname
sudo apt-get install biosdevname
Note
You can disable it by using kernel command line in grub config:
GRUB_CMDLINE_LINUX_DEFAULT="biosdevname=0"
and run
sudo update-grub
or simply uninstall the package.
sudo apt-get purge biosdevname
sudo update-initramfs -u
udev rules
This is the default on Ubuntu desktop. The udev rule /lib/udev/rules.d/75-persistent-net-generator.rules
creates during the first boot a custom rules /etc/udev/rules.d/70-persistent-net.rules
with MAC address of your interface to get persistent name for your interface.
Note
If you are already using udev rules, you need to remove /etc/udev/rules.d/70-persistent-net.rules
and to avoid it being regenerated at each boot you need to run
sudo ln -s /dev/null /etc/udev/rules.d/75-persistent-net-generator.rules
After that, if you use systemd, then you need to opt-in for predictable interface name, as describe above.
In Ubuntu Server 16.04LTS all I did was run:
ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules
Then create the file using
sudo vi /etc/systemd/network/10-internet.link
and add the following
[Match] Path=pci-0000:(your device mac address) [Link] Name=eth0 (or whatever you want to name it)
:wq
to save the filethen reboot and adjust your
/etc/network/interfaces
file.. then reboot again
Hope this helps someone