0

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).

0

1 Answer 1

0

You need to run "netplan apply" otherwise the new configuration will not processed, for ecample invoking the backend network manager and systemdworkd.

Also, in using for example bonds or bridges, they are not removed even if we delete from their configuration in yaml configuration file

"... Known issues: netplan apply will not remove virtual devices such as bridges and bonds that have been created, even if they are no longer described in the netplan configuration. That is due to the fact that netplan operates statelessly and is not aware of the previously defined virtal devices. ..."

https://manpages.ubuntu.com/manpages/jammy/man8/netplan-apply.8.html

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.