Red Hat 5.5 virtual machine NICs bind to different configurations

Applies to: Hyper-V Server 2008Microsoft Hyper-V Server 2008 R2

Symptoms


Red Hat 5.5 virtual machine NICs bind to different configurations after reboot.
This may affect CentOS systems as well. Linux Integrated Components version 2.1 is installed as well.

Consider the following scenario with a VM with 4 virtual NICs:

Hyper-V vNIC        VM Device   Configuration
Integrated NIC#1    NIC #1      ifcfg-seth0
Integrated NIC#2    NIC #2      ifcfg-seth1
Integrated NIC#3    NIC #3      ifcfg-seth2
Integrated NIC#4    NIC #4      ifcfg-seth3

You then reboot the virtual machine. After reboot, the NIC configuration shows up as the following:

Integrated NIC#1    NIC #1      ifcfg-seth3
Integrated NIC#2    NIC #2      ifcfg-seth2
Integrated NIC#3    NIC #3      ifcfg-seth1
Integrated NIC#4    NIC #4      ifcfg-seth0
  • From the internal NIC configuration in /etc/sysconfig/ifcfg-sethn, no changes have been made.
  • Using synthetic NICs with no other NICs bound to the system.
  • MAC address is setup as dynamic or static.

Cause


The VMBus driver on the Windows host cannot guarantee what order the devices will be enumerated on boot. Even with a static MAC address assigned to each adapter, if device B comes up before device A, then device B will receive the seth0 name. Linux vendors have developed udev rules to work around this. Udev will look at the devices as they come up and see if there are rules for that particular device. For example, the rules can determine if a NIC has been seen and if it needs to be assigned a specific device name. For networking, this is all tracked in /etc/udev/rules.d/70-persistent-net.rules.

Resolution


  1. Set static MAC addresses to your NICs for the VMs.
  2.  In the /etc/udev/rules.d/70-persistent-net.rules file, add the following entries:

    # net device ()
    SUBSYSTEM=="net", ACTION=="add", DRIVER=="?*", SYSFS{address}=="00:11:2a:3b:4c:5d ", SYSFS{type}=="1", KERNEL=="seth*", NAME="seth0"

    Please note the case sensitivity of all the parameters you enter. This tells the network subsystem to add a device named seth0 if there is a NIC present with MAC address 00:11:2a:3b:4c:5d.
  3. Do this for all your NICs and make sure the MAC address is static and will bind to the correct device.