On Mon, 19 Oct 2020, Theo de Raadt wrote:

Lee Nelson <[email protected]> wrote:

If I have multiple USB Ethernet adapters of identical make and model,
how does OpenBSD distinguish them over time.

In the order their drivers reach "interface attach" code.  There are
multiple reasons the drivers could reach this out of order.

In other words if
there's a reboot or the adapters get unplugged and moved around and
plugged back in, is there a way to make sure that the adapters
associated with axen0 and axen1 maintain those associations?

No.

Is there some way to pin an interface to the adapters MAC address?

No method comes to mind.

Well there is a method, but it is incompatible with KARL kernel
relinking so I don't think people should use that, and hence I'm not
going to explain it.

A related question: if the adapters never move, and always stay in the
same place on their respective USB hubs, will they always be numbered
the same (axen0, axen1, etc)?

Cannot gaurantee that. Especially if they are on different usb busses,
or the initial probe fails, some probes may occur late and thus adjust
the order.

From my testing, all the adapters are plugged into the same hub (not a
good idea) and they don't get moved around, they appear to stay in order. I suppose that could depend on the quality of the hub being used. However, in the case of my RPI4, I have a USB3 hub connected to the root USB xHCI hub. If I move an adapter from that hub to one of the USB 2.0 ports (which are themselves a hub), then it's there's no real pattern was to which will come first, the adapters on the USB 3 hub or the adapter on the internal USB 2 hub.

The only real solution here, aside from using better hardware, seems to be to use adapters with different drivers. That is the approach I'm trying next.

I had considered some late-running script that would query the MAC's of each NIC and then configure them accordingly or rewrite the hostname.* files and call netstart on them, but that just seems sloppy and unreliable.

Reply via email to