MAC addresses on dual-NIC mainboards

Solution 1:

There's always more than one way to do anything :)

Solution 1

Motherboards with one of each?

Blacklist whichever module (ethtool -i eth0) is supporting the Realtek card.

Ubuntu supports module_name.blacklist=yes to blacklist it at boot and you should be able to change the modprobe options in the preseed environment so that it doesn't get probed later.


Solution 2

Let me rephrase the problem:

We have motherboards with two NICs and we want them to work consistently no matter which interface is plugged in. We can't always determine which interface (from the OS point of view) will be plugged in.

Set up bonding! Use an active-passive configuration (mode=active-backup miimon=100) with both interfaces as slaves. This way, it will always work no matter which interface is plugged in.


Solution 3

Are the motherboards consistent enough that the NICs always show up on the same PCI ID? Use udev rules to always assign the card on a particular PCI address to eth0 and the card on the other address to eth1.

Note that you can have two different udev rules that assign a device to eth0 - this allows you to handle the Realtek and e1000 case at the same time.

Solution 2:

You can try to add PXELINUX IPAPPEND 2 option to your pxelinux.cfg file to tell init scripts to use the interface that did the PXE boot:

/var/lib/tftpboot/pxelinux.cfg/default

LABEL linux
   KERNEL /ubuntu/casper/vmlinuz 
   APPEND initrd=/ubuntu/casper/initrd.gz root=/dev/nfs boot=casper netboot=nfs nfsroot=192.168.1.1:/var/lib/tftpboot/ubuntu --
   IPAPPEND 2

see: http://www.syslinux.org/wiki/index.php/SYSLINUX#IPAPPEND_flag_val_.5BPXELINUX_only.5D