0

Simply put, I want to change the name of the various network adapter as listed by ifconfig. On my current machine, running Linux Mint 18, my network adapters show up as enp0s31f6 and wlp2s0.

However, since i use a wyriad of linux machines every day, this gets confusing. Is there a way to change the above two to be named eth0 an wlan0 so that they match the other computers i use?

Bonus: The names I currently have seem somewhat random. What, if anything, are they generated from?

  • The other computers you use will sooner or later use the new names too. IIRC it's related to the Linux kernel (since V4?) and a rationale for the new naming scheme is that names don't change with hardware changes (previously, eth0 could become eth1 if you added a network card, with the new card usurping eth0). – xenoid Nov 1 '17 at 21:29
3

systemd interface naming

While some systems use udev for naming, some rely on systemd to define the names for interfaces. udev generally goes by mac address to give an interface a name, however this causes problems when you replace a nic - the mac changes, but generally you don't want a new interface name.

systemd uses the PCI bus position to determine the name, so that if you replace a card into the same slot, it will have the same name. This makes the names difficult to remember.

You can write your own systemd configuration file to give more easily memorable names.

In /etc/systemd/network create a file called [something].link. In this you have a match section and a link section:

[Match]
OriginalName=enp0s31f6 
[Link]
Name=eth0

There is more information in systemd.link

If your system is using udev to name interfaces, then the following should work:

Have a look at /etc/udev/rules.d/70-persistant-net.rules

This names network interfaces based on mac addresses.

You can see the mac addresses of your interfaces using ip addr.

The contents of the file contains entries like this:

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="xx:xx:xx:xx:xx:xx", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="enp0s31f6"

You can probably infer which is which from your existing names.

|improve this answer|||||
  • /etc/udev/rules.d/ is empty on my system. Also, there is no visible connection between the interface name and the MAC address of said interface. – Jarmund Nov 1 '17 at 23:51
  • Can you see net rules in /lib/udev/rules.d/ or /usr/lib/udev/rules.d? – Paul Nov 2 '17 at 0:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.