Change NIC name on Ubuntu 17.10

hi all,

In this post, I will explain how to change the network interface name in Ubuntu based distro. In my case, I used release 17.10 (artful).

Since Ubuntu 16.04 (maybe even before), the classic name of network interfaces like eth0 or wlan0 has been replaced by really nasty names and often impossible to memorize. In fact, a renaming process occurs during the boot of the OS. I do not know why exactly but I can prove it 🙂 

Update 05.01.18 : Thank to @Eduardo for information in its comment. The reasons why this renaming is performed is explained in detail here : 

It is possible to show this renaming process by looking in the kernel log after the boot. Once you are logged into Ubuntu, open a terminal and display kernel log and filter output with egrep for example.

As you can see, during the boot, 2 network devices are detected, eth0 and wlan0, and for an unknown reason, they are renamed. It is possible to add a special command in the Grub configuration to avoid this renaming process. To do this, edit the file /etc/default/grub.

Search for the variable GRUB_CMDLINE_LINUX and set it to the following value : net.ifnames=0 biosdevname=0. In my case, I commented the default line, created a new one with the value. Once modified, you must have this entry in the file.

After that, it is necesary to reload this change. You can do it simply using this command:

Just reboot your system and the name of the NICs on your system should not be changed ! 
 

ps: If someone knows why Ubuntu performs this renaming, please let me a comment !

Bookmark the permalink.

5 Comments

  1. Hi Cyrill, this is already an older feature and has been published by a ubuntu developer in 2015. Follow this link: https://lists.ubuntu.com/archives/ubuntu-devel/2015-May/038761.html

    Second link: https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/

    • Cyrill Gremaud

      Hi eduardo and thank you for your useful information ! I better understand the reason of this renaming. I will modify my post to include the links for more information about this choice.

  2. Helllo Cyrill.
    Thanks for your good explanation. It worked for Ubuntu 16.04 LTS…
    Unfortunately it is not working with 18.04… Or did I something wrong?
    Here is my /etc/default/grub

    GRUB_DEFAULT=0
    GRUB_HIDDEN_TIMEOUT=0
    GRUB_HIDDEN_TIMEOUT_QUIET=true
    GRUB_TIMEOUT=10
    GRUB_DISTRIBUTOR=lsb_release -i -s 2> /dev/null || echo Debian
    GRUB_CMDLINE_LINUX_DEFAULT=”net.ifnames=0 biosdevname=0″
    GRUB_CMDLINE_LINUX=””

    After “update-grub” and a reboot, nothing has changed…
    Any suggestions…???

  3. its me again…
    I found the reason why it didn’t work…

    in the sub directory /etc/default/grub.d is now a file named
    50-curtin-settings.cfg
    this file overwrites the “GRUB_CMDLINE_LINUX_DEFAULT=” in the ../default/grub file.
    All I had to do is pasting the ”net.ifnames=0 biosdevname=0″ into “50-curtin-settings.cfg”
    update-grub and reboot… now it works as expected.

    Thanks again…

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.