8

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

  • Why do you want it disabled? – Kaz Wolfe Sep 17 '16 at 23:21
  • Because i use command line to manage my wifi USB interface and i use scripts that use old naming. Than we could speak hours about what I consider as a very useless systemd interface "predictable policy" but... that's not realy the point here :) – kcdtv Sep 17 '16 at 23:25
  • If you have scripts that do management and you use the same card, why not just change the scripts to use the correct (and better) names? This way you'll always know which one you're working with. If you always only have these two cards plugged in, make the script find the other card and set it up. – Kaz Wolfe Sep 17 '16 at 23:27
  • There are not better names... i will not enter in deeper considerations about this, that's really not the point here, you consider they are better but you might use your system i a way, i use it in a different way... I actually have a lot of card... but really that not the point here.... – kcdtv Sep 17 '16 at 23:29
  • 1
    The new naming scheme sucks. Now we need separate script when the USB device is changed - because of the name, bound to mac address. – Nuclear Mar 12 '17 at 22:18
8

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

  • 1
    Hi Jeremy31 and thank you for you answer – kcdtv Sep 19 '16 at 16:36
  • . My /etc/udev/rules.d/ directory is empty. I have a 80-net-setup-link.rules in /lib/udev/rules.d. I did the same than suggested in this directory but the USB wifi device is still named with the mac address. I'll try to find a way and would update when i find something... thanks again – kcdtv Sep 19 '16 at 17:08
  • Just do it to /etc/udev/rules.d/80-net-setup-link.rules as I just checked my ubuntu 16.04 machine and plugging in an older USB wifi device shows it as wlan1 in iwconfig. I am not sure why the net.ifnames=0 in the grub file is not enough to keep it from changing USB devices – Jeremy31 Sep 19 '16 at 21:55
  • It worked! I copied the rule 80 from /lib/udev/rules.d to /etc/udev/rules.d. Than I duplicated it in this directory, renaming it 80-net-setup-link.rules.bak. And I finally created the symlink to /dev/null_. After reboot my USB WiFi card does not show up now as "wlan1" interface. Thank you very much! :) – kcdtv Sep 20 '16 at 14:34
2

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.

0

I have ubuntu studio and had the same problem: a long wlxxxxx name AND the wifi connected but NOT WORKING !

Ubuntu studio has a special low latency kernel and I suspected that the long name could be a problem.

So, I rename it to wlan0 inspired by this thread. I did the following:

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

2) edited the name there. In my case there was a line: NAME=="", ENV{ID_NET_NAME}!="",NAME="$env{ID_NET_NAME}"

I just put "wlan0" instead of "$env{ID_NET_NAME}".

And now wifi WORKS !

GR

0

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.

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.