Changing network interface name to something more human-readable.

This is a very loose translation of this article by SloniuPL.

Since the Systemd 197 hit the Arch Linux repositories the network interfaces names have changed. They are no longer called eth0 or wlan1 but something like enp0s10 (if its a LAN card) or wlp5s0 (for WLAN devices). I don’t care most of the time but sometimes I need them to be more meaningful.

Its best to do this right after the installation and before You will connect to the network otherwise You will have to edit Your netctl profiles and change the network interfaces in them then disable the profiles and re-enable them. Also You will have to change the interfaces for Your shorewall if You have already configured it. No big deal but it can be a pain in the butt.

How to change the network interface name to something more human-readable?

First of all we need to find out what the devices mac address is. To do that run this command:

ip link

It will spit out something like this:

[andrzejl@wishmasus ~]$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp0s10: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
link/ether AA:BB:CC:DD:EE:FF brd ff:ff:ff:ff:ff:ff
3: wlp5s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ether ZZ:YY:XX:WW:VV:UU brd ff:ff:ff:ff:ff:ff
[andrzejl@wishmasus ~]$

Now that we know the mac addresses of the devices we will use them while creating a udev rule. Open terminal and run:

su -c "mcedit /etc/udev/rules.d/10-network.rules"

and paste (SHIFT+INSERT) this:

SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="AA:BB:CC:DD:EE:FF", NAME="wired0"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="ZZ:YY:XX:WW:VV:UU", NAME="wireless0"

Don’t forget to replace AA:BB:CC:DD:EE:FF and ZZ:YY:XX:WW:VV:UU with the actual mac addresses. The wired and wireless names are optional. Arch Linux folks discourage the use of the oldschool eth and wlan. My network interfaces are for example called docketh1, asuseth0 and wireless0.

Save the file (F2) and close mcedit (F10).

Reboot the machine.

Cheers.

Andrzej

AndrzejL

"Never meet Your heroes. Most of the time you'll only end up disappointed." White Polak Male Husband Employee Hetero Carnivorous Fugly Geek @$$hole with ADD Catholic “Some men just want to watch the world burn.”

Comments are closed.