[CentOS] Back to eth shuffling ...

Thu May 14 23:47:31 UTC 2015
Kahlil Hodgson <kahlil.hodgson at dealmax.com.au>

On 15 May 2015 at 03:51, Ashley M. Kirchner <ashley at pcraft.com> wrote:

> After the machine boots and I look in /root/ksnet-devices, I see the MAC
> addresses for the devices as:
> Port1 -> eth0
> PCIe Card-> eth1
> Port2 -> eth2
>
> And yet, during the machine's POST (which  can verify by the PXE boot up of
> each device), it correctly enumerates the ethernet devices as:
> Port1
> Port2
> PCIe card
>
> So where and why is the order changed when the kernel kicks in and start
> booting the machine? And how can I stop it, or change its behavior? I'm not
> seeing any 'renaming' going on in dmesg like I sometimes find. So something
> is causing this and I can't figure it out.
>

​Yeah, my understanding is that the kernel does not really trust all the
information that the BIOS tells it and probes for the network devices
itself.​

I'm thinking, since you are using kickstart and PXE boot, you're not going
to know the HWADDR for your NICs before hand, but you probably do have a
predictable pci bus layout.

So grab pciutils package and run:

    lspci | grep Ethernet

I get something like

00:0a.0 Ethernet controller: NVIDIA Corporation MCP67 Ethernet (rev a2)
01:06.0 Ethernet controller: Intel Corporation 82541PI Gigabit Ethernet
Controller (rev 05)
01:07.0 Ethernet controller: Intel Corporation 82541PI Gigabit Ethernet
Controller (rev 05)

The first number is the bus id which is going to be consistent across
machines with the same mainboard and nic layout.

So I can make a persistent-net.rules file like:

ACTION=="add", SUBSYSTEM=="net", BUS=="pci", ID=="0000:00:0a.0",
NAME="eth0"
ACTION=="add", SUBSYSTEM=="net", BUS=="pci", ID=="0000:01:06.0",
NAME="eth1"
ACTION=="add", SUBSYSTEM=="net", BUS=="pci", ID=="0000:01:07.0",
NAME="eth2"


Hope this helps.

K