Linux, Windows, Virtualization, OpenSource & Blogging

Change default network name (ens33) to old “eth0” on Debian 9

2
Change default network name (ens33) to old “eth0” on Debian 9
Change default network name from “ens33” to old “eth0” on Debian 9

Just after the Debian 9 installation, I came to know that the name of network interface got changed to “ens33” from old type “eth0“. If you ever interested in changing interface name to old type “ethX“, then here is the tutorial for you.

Interested in Debian 8 upgrade,

READ: How To Upgrade Debian 8 Jessie to Debian 9 Stretch

As you can see in the output of “ip a” command, my Debian 9 system is having a network adapter called “ens33“.

This is just the case of VMware and it may vary depends on your system hardware (In the case of VirtualBox it is “enp0s3“) but the procedure to get “ethX” back will be the same.
$ ip a

1: lo: <loopback,up,lower_up> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    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: </loopback,up,lower_up>ens33: <broadcast,multicast,up,lower_up> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 08:00:27:10:73:eb brd ff:ff:ff:ff:ff:ff
    </broadcast,multicast,up,lower_up>inet 192.168.1.6/24 brd 192.168.1.255 scope global dynamic ens33
       valid_lft 86366sec preferred_lft 86366sec
    inet6 fd50:1d9:9fe3:1400:85b2:6a34:5c9d:f3e/64 scope global temporary dynamic
       valid_lft 7176sec preferred_lft 3576sec
    inet6 fd50:1d9:9fe3:1400:a00:27ff:fe10:73eb/64 scope global mngtmpaddr noprefixroute dynamic
       valid_lft 7176sec preferred_lft 3576sec
    inet6 fe80::a00:27ff:fe10:73eb/64 scope link
       valid_lft forever preferred_lft forever

You can confirm that the Ethernet device got renamed during the system boot by using “dmesg” command.

$ sudo dmesg | grep -i eth

[    1.510948] e1000 0000:00:03.0 eth0: (PCI:33MHz:32-bit) 08:00:27:10:73:eb
[    1.510955] e1000 0000:00:03.0 eth0: Intel(R) PRO/1000 Network Connection
[    1.514587] e1000 0000:00:03.0 ens33: renamed from eth0

To regain the ethX back, edit the grub file.

$ sudo nano /etc/default/grub

Look for “GRUB_CMDLINE_LINUX” and add the following”net.ifnames=0 biosdevname=0“.

From:

GRUB_CMDLINE_LINUX=""

To:

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

Generate a new grub file using the “grub-mkconfig” command.

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

Generating grub configuration file ...
Found background image: /usr/share/images/desktop-base/desktop-grub.png
Found linux image: /boot/vmlinuz-4.9.0-3-amd64
Found initrd image: /boot/initrd.img-4.9.0-3-amd64
done

Edit the interface file and change the name of network device so that you will have a DHCP/static IP address for “ethX”.

READ: Install and configure DHCP server on CentOS 7 / Ubuntu 14.04

DHCP:

If your machine is on DHCP network, then:

$ sudo nano /etc/network/interfaces

Update below lines in interfaces files so that the network card can get an IP address from DHCP server.

FROM:

auto ens33
iface ens33 inet dhcp

TO:

auto eth0
iface eth0 inet dhcp

Static:

If your infrastructure does not have a DHCP server, then you may need to configure a static IP address for the network interface.

$ sudo nano /etc/network/interfaces

From:

auto ens33
iface ens33 inet static
           address 192.168.1.6
           netmask 255.255.255.0
           dns-nameservers 192.168.1.2
           gateway 192.168.1.2

To:

auto eth0
iface eth0 inet static
           address 192.168.1.6
           netmask 255.255.255.0
           dns-nameservers 192.168.1.2
           gateway 192.168.1.2

Reboot your system.

$ sudo reboot

After the system reboot, go and check whether you have got an “ethX” back.

$ ip a

1: lo: <loopback,up,lower_up> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    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: </loopback,up,lower_up>eth0: <broadcast,multicast,up,lower_up> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 08:00:27:10:73:eb brd ff:ff:ff:ff:ff:ff
    </broadcast,multicast,up,lower_up>inet 192.168.1.6/24 brd 192.168.1.255 scope global dynamic eth0
       valid_lft 86336sec preferred_lft 86336sec
    inet6 fd50:1d9:9fe3:1400:91f3:17c7:4a5a:dc84/64 scope global temporary dynamic
       valid_lft 7133sec preferred_lft 3533sec
    inet6 fd50:1d9:9fe3:1400:a00:27ff:fe10:73eb/64 scope global mngtmpaddr noprefixroute dynamic
       valid_lft 7133sec preferred_lft 3533sec
    inet6 fe80::a00:27ff:fe10:73eb/64 scope link
       valid_lft forever preferred_lft forever

That’s All. Drop your thoughts in the comments section.

POSTS YOU MAY LIKE -:)

You might also like
  • fjleon

    this is wrong for default dhcp users. you do need to edit the /etc/network/interfaces file and replace every new interface name with eth0, otherwise you will be stuck without network on reboot. you even were told this over a year ago when you posted the same thing about ubuntu

Change default network name (ens33) to old “eth0” on Debian 9

2