I've been using Alpine Linux for a while, and finally solve the problem with variable network interface names upon reboot by setting rules to rename the interface depending on their MAC addresses.
I notice that OpenWrt use the same network interface naming scheme (eth0
instead of enp2s0
in Ubuntu). There isn't any problem on custom boards, because the number and location of the interfaces are probably fixed in the code or dts files. But what about x86 build? Does it suffer from similar issue where eth0
and eth1
swap between each boot? If it does, how can I solve the problem?
On a side note, I have been using OpenWrt as a QEMU guest, and with such configurations:
-netdev tap,id="tap-nic0",ifname="${hostname}-nic0" \
-device virtio-net-pci,id="nic0",disable-legacy=on,mac=52:54:00:75:b2:61,multifunction=on,bus="pcie.0",addr=0x02.0,netdev="tap-nic0" \
-netdev tap,id="tap-nic1",ifname="${hostname}-nic1" \
-device virtio-net-pci,id="nic1",disable-legacy=on,mac=52:54:00:5c:18:fe,bus="pcie.0",addr=0x02.1,netdev="tap-nic1" \
-netdev tap,id="tap-nic2",ifname="${hostname}-nic2" \
-device virtio-net-pci,id="nic2",disable-legacy=on,mac=52:54:00:17:53:7e,bus="pcie.0",addr=0x02.2,netdev="tap-nic2" \
... nic0
, nic1
, and nic2
are located at PCIe bus 00:02.0
, 00:02.1
, and 00:02.2
respectively, and they always become eth0
, eth1
, and eth2
in OpenWrt respectively. Now I am looking to use OpenWrt in a physical machine environment, maybe things are not the same.