Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 226966

Re: how to fix a virtual Network Adapter to be the first one (from guest point of view)

$
0
0

Most OSes assign the order of NICs by either the PCI slot of the device or the MAC address of the NIC. What you see in the BIOS or OS as NIC1 is not necessarily "Network Adapter 1" as seen in the esx-side VM config.

 

Your udev could be using the MAC address for ordering NICs, which would also explain your issue as the MAC of your 2nd NIC is lower than the 1st.

 

I did a test with a fresh VM Fedora 18 VM with 4 vmxnet3 NICs, and the OS numbered the NICs according to PCI slot addresses:

(On a side note, PXE booting via "Network boot from VMware VMXNET3" in the BIOS booted from the first NIC (lowest PCI slot) as well.)

# grep -i ethernet TestVM.vmx

ethernet0.generatedAddress = "00:50:56:90:7c:c5"

ethernet1.generatedAddress = "00:50:56:90:29:4f"

ethernet2.generatedAddress = "00:50:56:90:68:f3"

ethernet3.generatedAddress = "00:50:56:90:05:f9"

ethernet0.pciSlotNumber = "160"

ethernet1.pciSlotNumber = "192"

ethernet2.pciSlotNumber = "224"

ethernet3.pciSlotNumber = "256"

As you can see, the MACs were generated in a random non-sequential order, while the PCI slot number increases sequentially.

 

Inside the Linux VM i can see the following NICs:

# ifconfig

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

eth1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500

eth2: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500

eth3: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500


PCI bus point of view:

# lspci -bv | grep -i ethernet -A1

03:00.0 Ethernet controller: VMware VMXNET3 Ethernet Controller (rev 01)

        Subsystem: VMware VMXNET3 Ethernet Controller

        Physical Slot: 160

--

0b:00.0 Ethernet controller: VMware VMXNET3 Ethernet Controller (rev 01)

        Subsystem: VMware VMXNET3 Ethernet Controller

        Physical Slot: 192

--

13:00.0 Ethernet controller: VMware VMXNET3 Ethernet Controller (rev 01)

        Subsystem: VMware VMXNET3 Ethernet Controller

        Physical Slot: 224

--

1b:00.0 Ethernet controller: VMware VMXNET3 Ethernet Controller (rev 01)

        Subsystem: VMware VMXNET3 Ethernet Controller

        Physical Slot: 256

 

 

Mapping PCI addresses to individual NICs by MAC:

# lspci | grep -i ethernet | awk {'print $1'} | while read pciid; do echo $pciid $(cat /sys/bus/pci/devices/*$pciid/net/*/address) $(cat /sys/bus/pci/devices/*$pciid/net/*/uevent); done

03:00.0 00:50:56:90:7c:c5 INTERFACE=eth0 IFINDEX=2

0b:00.0 00:50:56:90:29:4f INTERFACE=eth1 IFINDEX=3

13:00.0 00:50:56:90:68:f3 INTERFACE=eth2 IFINDEX=4

1b:00.0 00:50:56:90:05:f9 INTERFACE=eth3 IFINDEX=5

 

 

So yeah, in my case with Fedora 18 and a fresh system, it seems to number everything as you would expect. Note that additional NICs added after installation would could not follow this pattern.

Check out the NIC device PCI config in the VM's vmx and your udev config (/lib/udev/write_net_rules).


Viewing all articles
Browse latest Browse all 226966

Trending Articles