Change vmnic order on ESXi

Ever had an accident when out and about? Trip or fall at work? Or a problem with your vmnics on your ESXi server not ordering correctly?

Anyone that has built enough ESXi servers has come across this. Particularly if the hardware varies, however most annoyingly when it's exactly the same server and expansion cards and we want everything to be named "exactly" the same (because us techies can very picky).

Anyway to the point as you want a fix so you can get on with everything else you need to do right?!

This happens because ESXi assigns the vmnic number (e.g. vmnic0, vmnic1.. etc) as the physical adapters are detected. While this should happen in an order that makes sense (based on PCI bus numbering and/or MAC address increments) this does not always happen. Now this happens alot less than it used back when I was doing ESX 3.x installs, it still occurs with ESXi 5.1!

1. Put your host in maintenance mode (VMs will need to be powered off or vMotioned to other hosts if in a cluster) 

2. SSH to the ESXi server and login as "root".
Note: You may need to start the SSH service (under Configuration --> Security Profile)

3. Edit the hosts config file:
vi /etc/vmware/esx.conf

4. Locate the section where the devices are mapped to names:
e.g. /device/000:003:00:0/vmkname = "vmnic0"

5. Make your required name changed so your vmnics are labelled as you require.

6. Don't forget to save!

7. Reboot the ESXi server

8. Exit maintenance mode

9. Power on and/or vMotion the VMs back (if DRS is not enabled).

10. Job done!

No comments:

Powered by Blogger.