By Stephan Wijman

Since Stretch, new systems by default no longer use old-style interface names such as eth0, eth1, wlan0, wlan1. The new system uses names based on hardware location, like eno0, enp0s31f6, wlp1s7 (or in the case of USB dongles, MAC address: enx2c56ac39ec0d).

These old-style interface names can be restore by following the steps below. These commands have to be run as root.

Current interface names

To view the current interface names run the following command:

ip a

The output would look similar as this:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 38:d5:47:ab:a8:5c brd ff:ff:ff:ff:ff:ff
    inet 192.168.10.130/24 brd 192.168.10.255 scope global dynamic enp3s0
       valid_lft 876sec preferred_lft 876sec
    inet6 fe80::3ad5:47ff:feab:a85c/64 scope link 
       valid_lft forever preferred_lft forever
3: enp0s31f6: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 38:d5:47:ab:a8:5b brd ff:ff:ff:ff:ff:ff

To confirm the names they were renamed from, the following command can be run to extract the information from the dmesg output:

dmesg | grep -i eth

This will give the following output:

[    1.100907] r8169 0000:03:00.0 eth0: RTL8168h/8111h, 38:d5:47:ab:a8:5c, XID 541, IRQ 126
[    1.100909] r8169 0000:03:00.0 eth0: jumbo features [frames: 9194 bytes, tx checksumming: ko]
[    1.103914] r8169 0000:03:00.0 enp3s0: renamed from eth0
[    1.406676] e1000e 0000:00:1f.6 eth0: (PCI Express:2.5GT/s:Width x1) 38:d5:47:ab:a8:5b
[    1.406681] e1000e 0000:00:1f.6 eth0: Intel(R) PRO/1000 Network Connection
[    1.406774] e1000e 0000:00:1f.6 eth0: MAC: 12, PHY: 12, PBA No: FFFFFF-0FF
[    1.449864] e1000e 0000:00:1f.6 enp0s31f6: renamed from eth0

In the example above we have enp3s0 and enp0s31f6. Mark these interface names down to be replaced later on in the interfaces file. (Since the first interface enp3s0 was renamed from eth0, the 2nd interface will have been eth0 before it got renamed to enp0s31f6)

Disable consistent interface naming

To disable the consistent interface naming GRUB config needs to be updated.

Edit the default GRUB config file:

nano /etc/default/grub

Locate the line with GRUB_CMDLINE_LINUX and add net.ifnames=0 biosdevname=0. Below is an example how it would look like:

GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"

Now update GRUB to use the new config with the following command:

update-grub2

Update interface configurations

Now the interfaces file needs to be update to make sure that at the reboot the old-style interfaces have settings associated with them. We use the interfaces names noted down from before.

Edit the intefaces configuration file:

nano /etc/network/interfaces

Replace the old (consistant) inteface names, with the old-style names.

Before:

# The loopback network interface
auto lo
iface lo inet loopback

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

allow-hotplug enp0s31f6
iface enp0s31f6 inet dhcp

After:

# The loopback network interface
auto lo
iface lo inet loopback

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

allow-hotplug eth1
iface eth1 inet dhcp

Now reboot to make the new setting active:

reboot

Verify interface names

To verify the interfaces names use the first command again:

ip a

The output will now show the old-style interface names:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 38:d5:47:ab:a8:5c brd ff:ff:ff:ff:ff:ff
    altname enp3s0
    inet 192.168.10.128/24 brd 192.168.10.255 scope global dynamic eth0
       valid_lft 857sec preferred_lft 857sec
    inet6 fe80::3ad5:47ff:feab:a85c/64 scope link 
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 38:d5:47:ab:a8:5b brd ff:ff:ff:ff:ff:ff
    altname enp0s31f6

Stephan Wijman • 31 Articles

View Articles