Are you like me? Do you also find it hard to remember that your ethernet port is named "enp3s0"? Here’s a quick way to rename your NICs with a UDEV rule.


To be fair, the new naming scheme is better from a systems design point of view. The old NIC names that you are probably familiar with - eth0, eth1, wlan0, etc. - were nice for humans to use but were named essentially on the order by which the kernel happened to probe the devices during boot. For some hardware this meant that you could not expect the same physical device to have the same interface name across reboots.

That said as a human using a laptop I’m less worried that "enp3s0" refers to the specific PCI bus location of the NIC, and more interested in having a name that I can remember.

To change the name of your NIC you need the MAC address of the device. On most linux systems this can be found with cat /sys/class/net/<current_nic_name>.

Once you have or can find the MAC address of the NIC, as root, create a new udev rule file, /etc/udev/rules.d/10-nic-name.rules. Note: the format of the filename is somewhat important here. The number prefix specifies the order in which the udev rules should be applied; the 10 here causes this new rule to run before the NIC devices are otherwise manipulated. The suffix .rules is the other required part of the name so that the udev system reads the file. To that new file add the following rule to rename your devices:

SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="<mac-address>", NAME="lan"

Now you can name your NIC whatever you want.

" "