Linux: Disable assignment of new styled names for network interfaces

Hi,

newer Linux distribution do assign network names like enp0s13 or eno1 instead of the old style ethx names.

This feature is called Predictable Network Interface Names and should name each interface in an reproducible way. The previous method had some problems if more then one NIC Adapters are connected. Sometimes, after a reboot, the name ethx has switched between the interfaces.

Predictable Network Interface Names are introduced with systemd v197.

To switch to the old method you have to append 2 kernel parameters.

For debian/ubuntu systems edit /etc/default/grub. Locate the line

GRUB_CMDLINE_LINUX=""

and append net.ifnames=0 biosdevname=0

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

then update the /boot/grub/grub.cfg by

root@debdev:~# update-grub

On a Raspberry Pi edit /boot/cmdline.txt

root@debdev:~# nano /boot/cmdline.txt

and append net.ifnames=0 biosdevname=0. For example

dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 apparmor=1 security=apparmor rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait net.ifnames=0 biosdevname=0

Then reboot your device

Note:Be aware you have to reconfigure your network settings after changing the network name convention!! . For example add an additional entry for eth0 in /etc/network/interfaces otherwise you will get no IP Address from DHCP after a reboot.

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug enp0s3
iface enp0s3 inet dhcp

# Fallback unpredictable
allow-hotplug eth0
iface eth0 inet dhcp

Another generally way is to directly editing /boot/grub/grub.cfg. But be aware. Syntax errors may prevent your device from booting!!
Set permissions for edit and open /boot/grub/grub.cfg

root@debdev:~# ls -l /boot/grub/grub.cfg
-r--r--r-- 1 root root 5855 Okt  9 08:23 /boot/grub/grub.cfg
root@debdev:~# chmod u+w /boot/grub/grub.cfg
root@debdev:~# vi u+w /boot/grub/grub.cfg

Then locate your boot entry(ies) beginning with linux and append the parameters

linux /boot/vmlinuz-4.9.0-7-686 root=/dev/sda1 ro quiet net.ifnames=0 biosdevname=0

and set permissions back.

root@debdev:~# vi u-w /boot/grub/grub.cfg

Michael

Advertisment to support michlstechblog.info

Time limit is exhausted. Please reload CAPTCHA.

Original Theme by Schiy · Powered by WordPress