Score:0

netplan mac address matching doesn't seem to work

us flag

I have a small pc box that only have one network interface, and since I needed 2 more interfaces, I've bought two usb network cards. Both same manufacturer. I wanted to rename interfaces (since they originally have pretty complex names) to: eth1 and eth2. The box is running ubuntu 22. In theory this is pretty simple, and it should be something along these lines:

  network:
  version: 2
  renderer: NetworkManager
  ethernets:
    eth0:
      dhcp4: true
      match:
        macaddress: 12:e3:80:ff:c0:a7
    usbnic7f:
      match:
        macaddress: 00:e0:4c:68:04:7f
      dhcp4: no
      addresses:
        - 192.168.3.2/24
      set-name: eth1
    usbnicf2:
      match:
        macaddress: 00:e0:4c:68:55:f2
      dhcp4: no
      addresses:
        - 192.168.5.4/24
      set-name: eth2

However, for some reason, naming of the interfaces is inconsistent across the reboots. It seems as though 'match macaddress' does not work at all, as sometimes eth1 interface has 04:7f MAC and eth2 has 55:f2 MAC, and sometimes it's the opposite (meaning eth1 is 55:f2 and eth2 is 04:7f). This is very annoying. Could anyone please help ?

--- EDIT ---

Interestingly, this seems to 'sort of' work:

network:
  version: 2
  renderer: NetworkManager
  ethernets:
    eth0:
      dhcp4: true
      match:
        macaddress: 96:08:85:46:ab:15
    enx00e04c6805a8:
      addresses:
        - 192.168.5.3/24
      match:
        name: enx00e04c6805a8
      set-name: eth1
    enx00e04c685602:
      addresses:
        - 192.168.4.2/24
      match:
        name: enx00e04c685602
      set-name: eth2

But only after I do : 'netplan apply'. If I just reboot the machine, interfaces come up NOT renamed, and without any IPs assigned. But after I do netplan apply, everything's good. This looks to me as some kind of timing issue (perhaps).

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.