Script to fix VMWare ESX 3.5 NIC Reordering after kickstart

Once we moved to VMWare ESX 3.+ we ran into a very annoying issue. The issue was that if you have multiple NICs from Multiple vendors, VMWare will reorder your NICs and cause havoc to you guys who use PXE boot/Kickstart. So I had to come with a work around that will alleviate this issue. I went ahead and created this script and I injected it in the post section of our kickstart profile and had it run after rebooting 3 times. Since After the third reboot the VMWare is done with its configuration, after the third reboot the script will run and then delete itself. Once all said and done your NICs will be in the proper order.

Some of you might just use it as a once shot deal manually and some of you might use it as I did, but I did not realize how many f you are having the same issue as I did. Since I posted this script it has ad close to 3000 hits. So for those of you who have used it and appreciated the work I have done or for those of you who have modified it and added to it. Please leave some feed back weather in the form of comments or in the forums.

Could you believe that VMWare says that a feature of there software will reorder your NICs after the kickstart???
So if this was the order of our NICS
03:02.0 Ethernet controller: Intel Corporation 82546EB Gigabit Ethernet Controller (Copper) (rev 01)
03:02.1 Ethernet controller: Intel Corporation 82546EB Gigabit Ethernet Controller (Copper) (rev 01)
eth0 == 03:02.0
eth1 == 03:02.1
When VMWare comes up it will reorder them so that vmnic0 will point to 03:02:01 when it should be 03:02:00 Now this only happens when you have a box with multiple nics from multiple vendors. This script will take care of it for you.

Here are some instructions on how to run this script and what you should do before and after you run this script on your ESX Server..

  1. run esxcfg-nics -l (keep the ouput so you can compare it to the new ouput after the script has done its job)
  2. copy this script in any directory you want… for instance  ( /tmp/ )
  3. Reboot your ESX server and once it comes up ESXwill reboot again to apply the nic changes.
  4. run esxcfg-nics -l and compare the new output to the old output…. ( The order should be correct now ).
  5. Leave me a comment on how my script helped you and digg this article. ( I would appreciate it ).

I have received numerous request on how to count reboots so that this script can run effectively right at the right moment. This is not an exact science and the number of reboots might have to be tweaked on a per environment basis, but here is what we use..

This entry was posted in Uncategorized and tagged , . Bookmark the permalink.

3 Responses to Script to fix VMWare ESX 3.5 NIC Reordering after kickstart

  1. kklo says:

    I’m unable to download your Script for vmnic reorder in esx 3.5. I’ve a similar issue on vSphere 4.0. Please check the link.

Leave a Reply