Missing legacy ethX interfaces names

If you are a old school sys admin, and wants to keep the default ethX convention for internet names,  you can do it easily on Ubuntu and Debian.

When running Ubuntu and Debian on a virtual machine on top of KVM, you will see that the name is ibmvethX, instead of the ethX. This changes happened on newer version (Ubuntu 15.10+ and Debian 10) due to a lot of benefits of interfaces naming when doing PCI hot plugs and replacement.

So, in order to solve it you have two options, changing the full ifname mechanism as a general change, doing:

Changing ifname in the kernel

Edit your /etc/default/grub. Change the the following line from:

GRUB_CMDLINE_LINUX=""

to

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

And then running:

# update-grub

Other than doing it, youou can also just change one interface, so, you can have more control.

Persistent udev naming

In order to run persistent name, which I personally prefer better, you can create a file name /etc/udev/rules.d, with the following content:

SUBSYSTEM==”net”, ACTION==”add”, ATTR{address}==”4c:45:42:45:01:09″, NAME=”eth0″

This is going to tell udev that a interface with mac ‘4c:45:42:45:01:09‘ should be named eth0. After that, just replace your configurations at /etc/network/interfaces and reboot your system. You should see eth0 instead of ibmveth0 now.

 

Advertisements

One thought on “Missing legacy ethX interfaces names

  1. Thanks for the post, Breno. Two comments:
    Could you clarify that /etc/udev/rules.d/ is a directory, and make a recommendation on the name we should choose for the file, like 10-local.rules ?
    Could you mention that the MAC address can be obtained with ‘ip add’ command, so that we set our own MAC address, not the one you mention ?

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s