I have a ubuntu vm on ESXi 5.5 with 6 e1000 interfaces. And at creation of the vm I assign a different network to all of them and power it up.

When I login to linux I see eth0-eth5 but the order is not as I expected to to be. I expected network adapter 1 to be mapped to eth0 and net adapter 2 to eth1 and so on

Any idea why this is so and how to fix it please?

3 Answers 3


Two ways I learned were:

  • You can look at the MAC address on the network settings on vmware for each NIC and do a ifconfig to check them against at the console.

  • If you have six lines disconnect 5 of them this way. First edit the profile and highlight the Network Adapter 1 thru 5. Under the settings and uncheck the "connect" button. Then:

    cd /sys/class/net
    grep "" eth0/*

    Look for carrier being in a 1 or 0 (zero) state. The one that is in the 1 state is the one your looking for. Then you can assign the VLAN or IP needed.

    Do this for each of the NICs listed eth0, eth1, eth2, etc.

Both actions allow you to see the MAC address but the second allows you to see more of the config details.


We had this problem, too. We assumed that it had to do with the virtual PCI slots the vNICs were in. Iirc, the first three vNICs were fine but with more the order of the eth's was weird.

We never really fixed this because we were able to get rid of VMs with so many vNICs soon.

I don't know Ubuntu but look if there's a file named something with "persistent" and "net" under /etc/udev/rules.d/. Get the MAC addresses from your vNICs and map them to the ethX of your choice there. You should find rules like

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:01:02:03", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

If you want the vNIC with MAC address 00:50:56:01:02:03 to be eth1, just change NAME="eth0" to NAME="eth1" and reboot.


Today, I deployed a VM with 3 SCSI controllers and 2 vNICs. For the BIOS, the first vNIC was NIC 2 and the second vNIC was NIC 1. I compared the vmx file to another one (2 vNICS but only 1 SCSI controller). The "normal" VM looked like this:

ethernet0.pciSlotNumber = "192"
ethernet1.pciSlotNumber = "224"

The "weird" VM looked like this:

scsi1.pciSlotNumber = "192"
scsi2.pciSlotNumber = "224"
ethernet0.pciSlotNumber = "256"
ethernet1.pciSlotNumber = "1184"

As you can see, the additional SCSI controllers occupy the slots where the vNICs are in the other VM. So it seems it really has to do with virtual PCI slots.


This worked for me under vmware, where there are often these files (possibly you need the vmware kernel modules):

  • /sys/bus/pci/devices/0000:.../label
  • /sys/bus/pci/devices/0000:.../acpi_index

and this synmlink:

  • /sys/bus/pci/devices/0000:.../firmware_node

The file label contains a line of text like: Ethernet0, Ethernet1, etc, and are numbered according to the original number in the OVF file.

The file acpi_index has a number (long int probably), and the numbers when sorted, match the original order of the interfaces in the OVF file, or order defined in the VM.

The filename part of the destination of the symlink firmware_node also collates in the same order as the interfaces in the original OVF file.

e.g ../../../LNXSYSTM:00/LNXSYBUS:00/PNP0A03:00/device:8b/device:8c

You can read that with readlink under the shell.

The most useful is probably the label file as it would be simple to extract the numeric part of the name and use it as a device name.

You can read the label for $dev like this:

read label < /sys/bus/pci/devices/$dev/label

and then extract the numeric suffix like this: ${label#Ethernet}

As a couplet which does nothing if there was no label:

read label < /sys/bus/pci/devices/$dev/label && echo ${label#Ethernet}

If you want to process all devices to get the order, you can read your ethernet devices in bus order, like this:

lspci -D -mm | sed -n -e 's/ "Ethernet controller".*//;T;p'

then you can pipe it into this segment to prefix the label

while read dev ; do read label < /sys/bus/pci/devices/$dev/label ; echo ${label#Ethernet} $dev ; done

You can then sort, and remove the label like this: sort | sed -e 's/.* //'

The whole expression to emit all ethernet devices in VMWARE defined order is:

lspci -D -mm | sed -n -e 's/ "Ethernet controller".*//;T;p' | while read dev ; do read label < /sys/bus/pci/devices/$dev/label ; echo ${label#Ethernet} $dev ; done | sort | sed -e 's/.* //'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .