Steve Litt <[email protected]> wrote: > Vitaliy Makkoveev said on Mon, 21 Nov 2022 03:48:21 +0300 > > >> On 20 Nov 2022, at 18:06, Odd Martin Baanrud <[email protected]> > >> wrote: > >> > >> Hello, > >> > >> I have a Raspberry Pi 4 with 2 USB NICâs attached. > >> One via USB3 (ure0), and the other via USB2 (ure1). > >> Since they are connected to different USB interfaces, I thaught they > >> would get configured the same way on reboot. But thatâs not the case. > >> They became swapped on reboot. > >> Is there a way to âlockâ the configuration I want? > >> So the USB3 NIC always become ure0, and the USB2 ure1. > >> > >> Regards, Martin > >> > > > >You could parse ifconfig(8) output to determine which names network > >interfaces received. But unfortunately, you canât rename interfaces. > > During your parsing you could assign each one to an environment > variable such that, for instance, $lan contains the network card name > of the LAN one, and $wan contains the network name of the one going to > the Internet. Unfortunately, this would probably mean changing a lot of > existing shellscripts, but it's doable.
But that is not the problem. hostname.* installs addresses on an interface, based upon the name of that interface. So it is too late for what you suggest. Unless the suggestion is have each hostname.* do a !command to a script which does the assigning. That is pretty crazy. pf.conf is not the problem either, because that can be entirely written using egress and groups. There is a problem with device attachment -> naming a device at that moment -> using that name in netstart.. but I am not sure how we could solve this without creating bigger problems for everyone else in the other non-hot-plug configurations, which is the majority of users with >1 network device. We also hit this problem with disks, and we worked around it with the DUID subsystem. I suppose there is some argument that we should support hostname.MAC files

