Adding vNICs in UCS Causes vmnic Reorder in ESXi 6.5

Problem

I added two new vNics to UCS. When I rebooted I realised there was something wrong. One of my iSCSI paths was down and one of the new vmnics wasnt working at all.

 

Troubleshooting

After much investigation it appeared that the NICS in the ESXI had been re-ordered.

Looking at the UCS I could see the following vNics to MAC mapping:

nics_ucs3

Here is the output from the ESXi server

nics_ucs2

 

Resolution

I needed to swap around vmnics in the ESXi host. Firstly get a list of the current assignments. Ensure host in is maintenance mode. SSH to the host and run the following command:

localcli --plugin-dir /usr/lib/vmware/esxcli/int/ deviceInternal alias list

Output:

Bus type  Bus address                                                               Alias
pci          s00000002:03.01                                                        vmnic1
pci         s0000000b:03.00                                                          vmnic2
pci         s0000000b:03.02                                                          vmnic5
pci         p0000:00:11.5                                                               vmhba0
pci         s0000000b:03.01                                                          vmnic3
pci         s00000002:03.02                                                          vmnic4
pci         s00000002:03.00                                                          vmnic0
logical   pci#p0000:00:11.5#0                                                     vmhba0
logical   pci#s0000000b:03.02#0                                                vmnic5
logical   pci#s00000002:03.01#0                                                vmnic1
logical   pci#s00000002:03.02#0                                                vmnic4
logical   pci#s0000000b:03.01#0                                                vmnic3
logical   pci#s0000000b:03.00#0                                                vmnic2
logical   pci#s00000002:03.00#0                                                vmnic0
logical   logical#logical#vmkernel#com.vmware.iscsi_vmk0#0  vmhba64

 

To fix my issue I needed to swap the following:

vmnic2 needs to be vmnic4
vmnic3 needs to be vmnic2
vmnic4 needs to be vmnic3

Re-assign the PCI

localcli --plugin-dir /usr/lib/vmware/esxcli/int/ deviceInternal alias store --bus-type pci --alias vmnic2 --bus-address s00000002:03.02
localcli --plugin-dir /usr/lib/vmware/esxcli/int/ deviceInternal alias store --bus-type pci --alias vmnic3 --bus-address s0000000b:03.00
localcli --plugin-dir /usr/lib/vmware/esxcli/int/ deviceInternal alias store --bus-type pci --alias vmnic4 --bus-address s0000000b:03.01

If logical aliases are being used then you will need to re-assign them as well.

localcli --plugin-dir /usr/lib/vmware/esxcli/int/ deviceInternal alias store --bus-type logical --alias vmnic2 --bus-address "pci#s00000002:03.02#0"
localcli --plugin-dir /usr/lib/vmware/esxcli/int/ deviceInternal alias store --bus-type logical --alias vmnic3 --bus-address "pci#s0000000b:03.00#0"
localcli --plugin-dir /usr/lib/vmware/esxcli/int/ deviceInternal alias store --bus-type logical --alias vmnic4 --bus-address "pci#s0000000b:03.01#0"

You will then need to reboot the host.