How can I show the old eth0 names and also rename network interfaces in debian 9 stretch?

Assuming that you have just installed your debian 9 stretch.

1) For reverting back the old names for the interfaces do:

nano /etc/default/grub

edit the line GRUB_CMDLINE_LINUX="" to GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"

then launch a grub-mkconfig for apply the changes inside the bootloader

grub-mkconfig -o /boot/grub/grub.cfg

You need a reboot after that.


2) For renaming the interfaces use:

  • For just a temporary modification take a look at the @xhienne answer.

  • For a permanent modification:

Start by creating / editing the /etc/udev/rules.d/70-persistent-net.rules file.

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

And insert inside lines like:

# interface with MAC address "00:0c:30:50:48:a1" will be assigned "eth0"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:30:50:48:a1", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# interface with MAC address "00:0c:30:50:48:ab" will be assigned "eth1"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:30:50:48:ab", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

If you want to assign for example a name like wan0 to eth0 you can use given my example:

# interface with MAC address "00:0c:30:50:48:a1" will be assigned "eth0"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:30:50:48:a1", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="wan0"

After the next reboot or using service networking restart you should see the changes applied.


EXTRA: Remember that after all this modifications you have to edit your /etc/network/interfaces file replacing the old interfaces names with the new ones!


EXTRA: If you want to know what MAC address your interfaces have, just do a

ip addr show

and look under the link/ section.


For question 1) see user3450548's answer. For question 2) you can give any name you want to an interface with iproute2:

ip link set ens33 down           # Else you will get "Device or resource busy"
ip link set ens33 name eth0