Tuesday, August 30, 2016

Incorrect Nic to Mac Address table at ESXi

We had a situation here on a cisco c240 server where the mac to vmnic number was different and not in series.
The pic that you see is after we fixed it. Earlier the vmnic numbering was
Intel  I350
vmnic0
vmnic1
vmnic2
vmnic3

 Intel 82599 10 Gig ethernet
vmnic4
vmnic6

 Intel ethernet x540
vmnic5
vmnic7

where it should have been how it is in the picture. What my colleague and mentor kung fu panda aka ravi sutrave did was pretty simple, he renamed these last 4 suckers (vmnics) with some temporary names like this in the esx.conf file,

:%s/vmnic4/vmnicx/g
:%s/vmnic6/vmnicy/g


:%s/vmnic5/vmnicp/g
:%s/vmnic7/vmnicq/g



and then renamed them back to the way they should have been in the first place.

:%s/vmnicx/vmnic7/g
:%s/vmnicy/vmnic6/g

:%s/vmnicp/vmnic4/g
:%s/vmnicq/vmnic5/g


Yes we did reboot the hosts few times and these settings were persistent across reboots. If you want to do the same on multiple hosts then you can use the plink and push these commands to all hosts at once.
I have handy dandy tool which will take care of it (enable ssh, push commands via ssh, disable ssh), try it and let me know if it doesnt work on twitter.
Here is the https://raw.githubusercontent.com/MrAmbiG/vmware/master/vTool/vTool_2016aug.ps1 vtool and in one of its menus it contains WinSSH. Run that and it will take you through the process of pushing any ssh commands to esxi hosts.
https://raw.githubusercontent.com/MrAmbiG/vmware/master/vTool/vTool_2016aug.ps1