Editing vmnic names – vSphere 5.5

One of my hosts in my lab had a bad NIC that I found the other day. It’s a quad port NIC and only two of the four ports were showing up. After some testing, I went ahead and replaced the NIC with a spare I had laying around and found that when I rebooted up the server, the vmnics were completely out of whack on the host.

Doing some research I found a KB article explaining that changing the file was unsupported, but since this is a lab and that’s never stopped me in the past I went ahead and edited the esx.conf file anyway.

I’ve already fixed this issue on my lab server, so I went back and broke it again for demonstration purposes. As you can see the vmnic27 NIC is completely jacked up. It should be vmnic7 in our order. So let’s edit the esx.conf file and make it work.

esx_conf_fix_pic1The configuration file can be found in the following directory on the ESXi host, /etc/vmware/esx.conf. Below are the excerpts from the esx.conf file where you need to make the appropriate changes to change the vmnic naming.


/vmkdevmgr/pci/s00000002:02.01/alias = "vmnic27"

/device/000:009:00.1/vmkname = "vmnic27"

/net/pnic/child[0014]/mac = "00:10:18:c0:f8:c6"
/net/pnic/child[0014]/virtualMac = "00:50:56:50:f8:c6"
/net/pnic/child[0014]/name = "vmnic27"

As you can see, there are three places in the file that wrong name exists. We should double check to make sure that what we’re changing accurately reflects the true NIC we want to change. We’re looking for ‘00:10:18:c0:f8:c6’.

esx_conf_fix_pic2So we confirmed that this is in fact the correct NIC as the MAC addresses coincide.

Note – if you have dual or quad port NIC, ESXi numbers the vmnics based on slot and then appears to number by MAC address in order. As you can see above, the quad port NIC has the exact same MAC address with the exception of the last 2 hexadecimal characters. The lowest number in hex, is the lowest vmnic number of that card and goes up until all numbered. Does this make sense? Well it does appear that way. If you take a look at the vmnics listed in the screenshot below, you can see that they correspond like this:

vmnic4 – 00:10:18:c0:f8:c0
vmnic5 – 00:10:18:c0:f8:c2
vmnic6 – 00:10:18:c0:f8:c4
vmnic7 – 00:10:18:c0:f8:c6 <- should be this but shows as vmnic27, because it’s broken

So the theory seems to hold up. You want to take this into consideration because I had more than one NIC that was screwed up because of an entire quad NIC change out. This meant I had to match MAC addresses to the vmnics to determine the order. Needless to say it was a mess, but I was able to correct it.

Now let’s fix. Make a backup copy of the esx.conf file, call it esxoriginal.conf if you want. Then we make the changes to the sections of the esx.conf file, save it back to the host, and reboot.


/vmkdevmgr/pci/s00000002:02.01/alias = "vmnic7"
/device/000:009:00.1/vmkname = "vmnic7"
/net/pnic/child[0014]/mac = "00:10:18:c0:f8:c6"

/net/pnic/child[0014]/virtualMac = "00:50:56:50:f8:c6"

/net/pnic/child[0014]/name = "vmnic7"

Once the reboot is complete, we take a look at our network adapters in the vSphere Client, and we can see that vmnic7 has been restored to its proper name. Pretty simple.esx_conf_fix_pic3

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s