Thursday, October 6, 2011

Reordering vmnics on vSphere 4.x

Today I've had an issue with a vSphere installation (esx 4.0 update 2). I've installed the esx server using a kikstart config file (ks.cfg) as usual, I've only one nic (integrated in the MoBo) so the service console (vswif0) was linked to my first nic (vmnic0) as usual.
image
Then I added physically a new nic (Intel Gigabit ET2 Quad Port Svr Adaptr) and restart my system, but I lost connectivity, no more ping VIC, etc... What had happened?
When I added the new nic, the esx server has reordered my nics, so vmnic0 is now vmnic1 and because vswif0 is linked to vmnic0 I've no longer connectivity.
Also, my new card (4 Gigabit ports) is supposed to be vmnic0, but the system has no drivers for this card and it doesn't appear at network interfaces level.
If I remove the nic card my old integrated nic returns to be vmnic0 and I recover connectivity.
If I install the driver for the new nic and add the card, when the system boots up if I link the LAN to the first port of the new 4-ports card I recover network connectivity, but this behavior will be a problem if I've to change or remove this 4-port card anytime, so I need that my integrated nic always be vmnic0 to avoid troubleshooting.
image
So I've done some googling and have read this post at VMware communities, also I've tried to download the Python script made by linuxdynasty to fix my nics order, but the link was broken, so I've done all the stuff by hand.
  • Make a copy of /etc/vmware/esx.conf file
cp /etc/vmware/esx.conf /etc/vmware/esx.conf.orig
  • Edit /etc/vmware/esx.conf file and seek vmnic occurrences, so I've replaced:
image
with:
image
And:
image
with:
image
And removed the following lines that duplicated my nic card:
image
  • Reboot the esx server
Now my integrated nic is always vmnic0 and I'll not have a network issue if I've to remove this 4-ports nic card.
This is the esx.conf file after reboot and added the new 4-ports card driver:
image
And finally I've my integrated nic as vmnic0 as I wanted:
image

No comments:

Post a Comment