How to revert USB wifi interface name (from wlxXXXXXXXXXXXX to wlanX)?

With Ubuntu 16.04 the USB wifi interface are now wlxXXXXXXXXXXXX where the X are the digits of the device's mac adress (policy of predictable interface name) More information about this can be find here: systemd:PredictableNetworkInterfaceNames

actually all interface naming has changed but I was able to go back to the old fashion way (ethX for ethernet interface, wlanX for inetrnal wifi card) modifying /etc/default/grub as suggested in the third post of this thread changing network interfaces name ubuntu 16-04 My problem is that this solution doesn't works for the USB interfaces and I still have this very annoying long name (i use command line a lot to play with my wifi interfaces) interface naming issue

 So here is my question: 

What should I do to disable this new rules for my USB wifi interface? Thanks for your advices and excuse my poor english. Bye


You missed one thing from https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/

sudo ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules

Then reboot

I think it needs to be the 80-net-setup-link.rules file in /etc/udev/ as the one laptop I updated to Ubuntu 16.04 from 15.10 still contained a file named /lib/udev/rules.d/73-usb-net-by-mac.rules and it contained

# Use MAC based names for network interfaces which are directly or indirectly
on USB and have an universally administered (stable) MAC address (second bit
is 0).

IMPORT{cmdline}="net.ifnames", ENV{net.ifnames}=="0", GOTO="usb_net_by_mac_end" PROGRAM="/bin/readlink /etc/udev/rules.d/80-net-setup-link.rules", RESULT=="/dev/null", GOTO="usb_net_by_mac_end"

ACTION=="add", SUBSYSTEM=="net", SUBSYSTEMS=="usb", NAME=="", \ ATTR{address}=="?[014589cd]:*", \ IMPORT{builtin}="net_id", NAME="$env{ID_NET_NAME_MAC}"

LABEL="usb_net_by_mac_end"

And it specifies /etc/udev/rules.d/80-net-setup-link.rules

This file does not exist in any of my clean installs of Ubuntu 16.04 but part of this must exist in other source code


A note for those looking for a similar use-case:

I had a problem with a USB WiFi dongle's driver unable to authenticate because of a rather long interface name in Debian (stretch).

Steps for resolution:

  1. copied /lib/udev/rules.d/80-net-setup-link.rules to /etc/udev/rules.d/

  2. changed $env{ID_NET_NAME} to $env{ID_NET_SLOT}

This maintained the uniqueness of the interface name while shortening it.

Update: This no longer seems to be an issue with Debian 10.


Instead of completely disabling the renaming you can override it to give your interfaces your own custom names. That keeps the static naming, but gives you a name you can remember and type in.

The existing naming system (/lib/udev/rules.d/80-net-setup-link.rules) only renames an interface if it hasn't already been given a name. So you can add your own rules at a higher priority in /etc/udev/rules.d which names the interfaces in your own way, which then stops the default system from naming those interfaces.

I have the file 70-wifi.rules in my system which names the interfaces according to the network they are connected to:

SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="00:0f:00:4a:c4:c9", NAME="wifi-root"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="00:19:86:31:dd:b7", NAME="wifi-main"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="38:2c:4a:48:27:49", NAME="wifi-local"

It's keyed by the MAC address of the interface, and results in:

$ 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: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 3c:d9:2b:73:ad:5d brd ff:ff:ff:ff:ff:ff
15: wifi-main: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
    link/ether 00:19:86:31:dd:b7 brd ff:ff:ff:ff:ff:ff
16: wifi-local: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
    link/ether 38:2c:4a:48:27:49 brd ff:ff:ff:ff:ff:ff
17: wifi-root: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
    link/ether 00:0f:00:4a:c4:c9 brd ff:ff:ff:ff:ff:ff

You could rename them wlan0, wlan1, etc. The beauty of this method is you get the names you want, and you benefit from static network interface naming. So the interfaces will always be named the same thing.