Force #wifi interface name on #Ubuntu 18.04

Friday, September 7, 2018 · 1 minute · 164 words

Using Udev, you can change the wifi interface name.

First, you need to get the mac address.

$ ip link

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: **wlp1s0**: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
    link/ether **9c:b6:d0:8a:71:11** brd ff:ff:ff:ff:ff:ff

My wifi interface is name wlp1s0 and its mac address is just after the keyword “link/ether” : 9c:b6:d0:8a:71:11.

Now, create or update a udev rules file in /etc/udev/rules.d containing something like :

$ cat /etc/udev/rules.d/60-persistent-net.rules

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="**9c:b6:d0:8a:71:11**", ATTR{type}=="1", NAME="**wlan0**"

You certainly need root access. Just change the address and choose the name you want, then reboot.

Check if all is ok with :

$ ip link

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: **wlan0**: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
    link/ether 9c:b6:d0:8a:71:11 brd ff:ff:ff:ff:ff:ff
console howto linux network shell ubuntu udev wifi