I have various small NUCs with attached on each one some of this USB3 LAN adapters (because the NUCs have only one Ethernet,
so I added extra ones with USB3 adapters).
You can see an image of the product here.
All of a sudden, probably due to an unattended automatic upgrade,
these devices started getting random MAC addresses.
Before:
Each USB3 attached device had an address in the form:
00:0E:C6:XX:XX:XX
Each one was distinct and always the same (stable), surviving reboots.
Now they have address like:
eth1 - be:7d:ee:6a:26:ab
eth2 - be:7d:ee:6a:26:ab
eth3 - be:7d:ee:6a:26:ab
eth4 - be:7d:ee:6a:26:ab
eth5 - be:7d:ee:6a:26:ab
all sharing the same randomly picked address.
In short, troubles:
- Each time the machine reboots, this random MAC address changes.
- They all share the same random MAC address.
Previously each one had a different and clearly distinct one.
The devices are identified in lsusb
as:
ASIX Electronics Corp. AX88179 Gigabit Ethernet
I have no idea what happened since latest automatic update, it's matter of the latest 2 days, 1h ago everything was working OK, after all these devices started to have this weird behaviour.
Could it be a problematic update?
Could it be a new driver been released
that randomizes the MAC address each time?
Could it be a feature from the Linux kernel or the distro or GRUB setting where USB LAN devices now get random MAC address each time?
But in this case, why all of them share the same?
They should be totally random….
I am seeking help and willing to do tests…
Regarding the OS:
Debian Version: 12.5
Linux 6.1.0-20-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.85-1 (2024-04-11) x86_64 GNU/Linux
Workarounds suggested so far, including the final one always working thanks to @A.B:
- Use parrent attribute "serial" in UDEV configuration to assign lan interface another name instead of relying on the mac address
- Use usb path of an usb nic address in udev rules in order to assign an interface name instead of mac address
- How to reset status of a network adapter before assigning the name in a udev ruleset?
Best Answer
This 6.8 kernel commit, backported to 6.1.x:
net: usb: ax88179_178a: avoid two consecutive device resets
intended to avoid a double reset on the AX88179-based NIC had as side effect to get a random MAC address for the NIC.
There's a fix in the works for future 6.9 kernel, already backported to kernel 6.1.85+ which acknowledges the previous issue (and is supposed to fix it). Here's the acknowledge part:
The problem is that Debian's kernel 6.1.0-20-amd64 already uses upstream kernel 6.1.85 which includes the fix. From OP's comment this doesn't appear to work correctly, since OP is using kernel 6.1.0-20-amd64.
What is guaranteed to work is to revert to the previous state: before the patch backported to 6.1.x on 2024-02-05. It appears that currently that means reverting TWO patches:
to be guaranteed to get it working as before (and getting the double-reset behavior back which didn't appear to be a problem then).
I could verify in the past weeks that reverting net: usb: ax88179_178a: avoid two consecutive device resets made it work, I didn't verify how the newer state (eg: kernel 6.1.85 or Debian 6.1.0-20-amd64) behaves. OP's Q/A suggests that maybe the 2nd patch intended to fix the behavior caused after the 1st patch is not enough and possibly yet-an-other-fix has to be provided.
To summarize, possible options today:
linux-image-6.1.0-18-amd64
either it works (nothing more to do)
or it doesn't (OP's case)
revert at least the first patch and recompile:
net: usb: ax88179_178a: avoid the interface always configured as random address (optional, can be kept rather then be reverted)
net: usb: ax88179_178a: avoid two consecutive device resets: (reverting this one is needed)
or wait yet-a-future patch fixing this:
UPDATE: this commit from 2024-04-18:
net: usb: ax88179_178a: avoid writing the mac address before first reading
fixes it (I tested it on a 6.8.x kernel). It should probably be included in next 6.1.x upstream kernel 6.1.88, and will be picked sooner or later by Debian. Added bonus: the reset appears to be made back at probe time and no more on interface UP. So the delay for transitions between down and up is now faster.