I want to map each hardware NIC to a specific linux network interface (ethX
) persistently, as currently when an ethernet cable is reconnected, it picks an interface seemingly at random. This is trivial with either systemd or udev, but BusyBox does not seem to have a built-in way to do this.
In /sys/class/net
, the symlinks from ethX
-> ../../devices/platform/soc/XXX.bus/XXX.ethernet/net/ethX
never change.
I have tried using nameif
, but this only maps MAC -> interface, and the MAC address is hardcoded in u-boot for each ethX, and is not representative of the actual NIC's MAC.
EDIT: This question will remain unanswered for now, because while I still haven't found a reliable way to map NIC -> interface in this embedded BusyBox environment, in my case, the hardware itself is also misbehaving in a way that cannot be solved with software alone.
ethaddr
andeth1addr
environment variables which provide a mac address for each of theethX
network interfaces in linux, but are not in any way related to the hardware itself. e.g.eth0
will always have theethaddr
MAC address, regardless of its physical NIC.