Usb0 changing mac address

Every time I reboot my librem5 the USB connection gets different MAC address. What’s ever weirder is that both ends of connection (my laptop and librem5) have different MAC addresses.

For example:

  • on laptop: 1E:6C:7D:D9:0E:01, on librem5: ea:c8:8e:c0:bc:53
    after librem5 reboot:
  • on laptop: 9A:31:DF:7F:FF:E3, on librem5: 22:5f:24:be:a8:a0

I found topics on this forum about changing MAC addresses, but they are related to wifi interfaces. Also man NetworkManager.conf says

     If left unspecified, it defaults to "preserve".

So I guess this is something that comes from usb driver, not NetworkManager (but I might be wrong here).

Obviously, I’d like to have the same MAC address every time I connect, so that it’s automatically handled by my custom connection specification in NetworkManager on my laptop.

What’s even funnier, the first six characters are supposed to indicate the manufacturer.

This is not done through NetworkManager (although maybe it could). Check out your systemd services, one of them sets up the USB interface, and it has a comment telling you how to make the MAC permanent. I don’t remember the service’s name from the top of my head though, sorry :frowning:

Yes, but only in a real MAC address (e.g. ethernet or WiFi device). For a USB device that is pretending to give you a network interface, the MAC address doesn’t matter and can be random and doesn’t indicate the manufacturer.

What does the manufacturer matter? It’s only for convenience in assigning the numbers. As long as you don’t have address conflicts within your network, you’re good.

I hearken back to the days when a MAC address was set in stone (before USB). If you ever saw the first six chars as 08-00-09 … you KNEW it was Hewlett Packard hardware, always.

So I was only just sayin’ and you already know my dry humor.

(Regarding USB, when I ran into something that had “Serial” as part of its name, it always had 25 or 9 pins.)

For the record, my WAPs report the manufacturer for wireless clients based on the first three bytes of the MAC address. This helps to sort out which wireless client is which in a busy network. Sure, it doesn’t affect anything functionally. It’s just to ease the network management task.

For a point to point connection, you don’t really need addresses at all.

For ethernet, it has been the case for a long time that the MAC address can be overridden by the host. There were several legitimate use cases (in addition to the more modern legitimate use case of wanting to enhance privacy).

So the MAC address can be set in stone, well in silicon, but the MAC address that will actually be used by that interface may be a completely different MAC address - because the host overrides the hardware (in silico) address with a different value before bringing up the interface - or even subsequently.

Thanks for the hint. I found the service: usb_gadget.service.

As described in the file I wrote down my current config:


1 Like