No Account Yet?

You are not logged in.

Add to: JBookmarks Add to: Facebook Add to: Windows Live Add to: Digg Add to: Del.icoi.us Add to: Reddit Add to: StumbleUpon Add to: Slashdot Add to: Netscape Add to: Furl Add to: Yahoo Add to: Blogmarks Add to: Technorati Add to: Newsvine Add to: Google Information
Script to fix VMWare ESX 3.5 NIC Reordering after kickstart E-mail
Virtualization - VMware
Written by Allen Sanabria   
Thursday, 19 June 2008 21:07

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/esx_nic_fix.py )
  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 ).

 

You can download the Script here, but you must become a member first before you download. Membership is free

Comments
Search RSS
dynasty     |SAdministrator |2008-06-19 08:24:20
Sorry guys, for not fixing the script sooner, as I just found a bug the other
day. The script will now work with all HEX conversions.
William   |75.83.202.xxx |2008-07-01 11:18:33
Can this be integrated after the kickstart to re-order the NIC before the
vmkmodules are loaded?
Anonymous   |70.15.55.xxx |2008-07-01 11:24:37
The way we made this work was to put this script in rc.local (during the post of
the kickstart process) and count the reboots and once the reboot were equal to 4
we would clear out rc.local and then the box will come up correctly.

We tested
this back and forth for over a week.
Anonymous2   |76.174.124.xxx |2008-07-10 19:43:59
Does not seem to work on ESX 3.5U1
dynasty     |SAdministrator |2008-07-11 02:24:20
Weird, we are running 3.5 here and this works for all of our HP/BM Servers...
Maybe the way I'm translating the PCI ID is off could you show me the order that
vmware sees your nics and what is there PCI ID. esxcfg-nics -l.

Let me know I
would like to help you fix this issue.
dynasty   |SAdministrator |2008-07-14 05:49:16
I just ran into the issue on one of my boxes the fix is now in.. Try it and let
me know.
Rick Parker  - Will this work with ESXi (3.5)?   |216.41.41.xxx |2008-07-28 06:12:08
Saw your postings and we are having a (what we thought) was a unique issue.
We
make a highly redundant and fault tolerant VM appliance and found that we need
to purchase a NIC bypass card for when the ESX server went totatlly down.
What
we found was that after manufacturing built the boxes and sent them out,
customers were seeing strange things. Namely they would have their ethernets
plugged in and we found that they had their physical NICs reordered so that the
2 motherboard NICs were named for the 1 vm on the box.
Will this script fix
that? and how to install on the boxes?
Thanks,
Rick
dynasty   |SAdministrator |2008-07-28 06:34:21
This script will fix the NIC reordering issue. Once you run this script
and
reboot your ESX server, ESX will see the change and reboot again. This time
to apply the changes that the script made.

I and others who have used my
script
usually use it as part of the post kickstart section or in the
rc.local
file.

You can use this script manually as well. Just copy this script
to your
server and run it as root like this... python script_name.py.

Before
you run this script I suggest that you run esxcfg-nics -l to see your current
output and then run python script_name.py then reboot. Once ESX server is back
up rerun esxcfg-nics -l and compare the differences.
radagenais  - HP DL380 G5 - doesn't work *cries*   |Registered |2008-11-26 16:30:31
We implemented this script on an HP DL380 G5 platform with on-board bnx2
(Broadcom) and HP PCIe e1000 (Intel) NICs. The reordering doesn't happen.

I can
manually fix the order by making sure that esx.conf and modules.conf reflect the
correct nic order. See a diff below. Problem: we are a kickstart site so we need
networking to work automatically after deployment. Manual fix isn't an
option.

I currently inject the esx_nic_fix.py to the filesystem during %PRE in
kickstart. I call it via rc.local, making a backup first, stage a new rc.local
for second boot which runs my post-install script. Reboots automatically after
services have finished loading.

(BTW I have to ksdevice=eth4 on install boot
because the reordering is wrong from the get-go. No biggie..)

(cont'd)
radagenais  - HP DL380 G5 - doesn't work *cries*   |Registered |2008-11-26 16:30:11
esx_nic_fix.py doesn't produce any errors or make any changes to esx.conf
(I make a backup and do a diff during post-install.sh)

Help?
 


root@hostie root #
diff /etc/vmware/esx.conf.correct /etc/vmware/esx.conf.default
Code:
< /device/0030.0/vmkname = "vmnic0"
---
> /device/0030.0/vmkname = "vmnic1"
286c286
< /device/0050.0/vmkname = "vmnic1"
---
> /device/0050.0/vmkname = "vmnic2"
346c346
< /device/0110.0/vmkname = "vmnic2"
---
> /device/0110.0/vmkname = "vmnic0"
356c356
< /device/0110.1/vmkname = "vmnic3"
---
> /device/0110.1/vmkname = "vmnic1"
412c412
< /device/0230.0/vmkname = "vmnic4"
---
> /device/0230.0/vmkname = "vmnic2"
422c422
< /device/0230.1/vmkname = "vmnic5"
---
> /device/0230.1/vmkname = "vmnic3"
425c425
< /net/pnic/child[0000]/name = "vmnic0"
---
> /net/pnic/child[0000]/name = "vmnic1"
428c428
< /net/pnic/child[0001]/name = "vmnic1"
---
> /net/pnic/child[0001]/name = "vmnic2"
431c431
< /net/pnic/child[0002]/name = "vmnic2"
---
> /net/pnic/child[0002]/name = "vmnic0"
441a442,447
> /net/pnic/child[0006]/mac = "00:1f:29:59:473"
> /net/pnic/child[0006]/name = "vmnic32"
> /net/pnic/child[0006]/virtualMac = "00:50:56:59:473"
> /net/pnic/child[0007]/mac = "00:1f:29:59:47:14"
> /net/pnic/child[0007]/name = "vmnic33"
> /net/pnic/child[0007]/virtualMac = "00:50:56:59:47:14"
root@hostie root #
268c268
>
dynasty   |SAdministrator |2008-11-26 16:38:25
I will do my best and try to help.. Please post this in the forum as the
comments section would not be a good fit for this. You can post in the scripts
section. If you can post the output of esxcfg-nics -l in the forum post as well
that would be helpful. Also after the nics.sort() function add the print
statement and also post that in the forum as well.
Only registered users can write comments!

3.22 Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

Last Updated ( Wednesday, 08 October 2008 07:04 )