there is no direct method to disable unused NIC ports in VMware ESX/ESXi. However, we may perform the below workaround using a utility called vmkchdev (VMkernel Change Device) to change the way of passing a particular device to be controlled by either the VMkernel or as a passthrough device to a virtual machine.
CAUTION: This is using an undocumented utility. You should test this out in a development/lab environment before using it in a production environment.
By passing the device over as a passthrough device, the vmnic is actually unrepresented to the VMkernel and does not show up under network adapters or even the unused/unlinked adapter list in the vSwitch configurations.
Here is an example of passing one of the NIC port as a passthrough which I did in lab:
Identify the vmnic's PCI slot, we do by running the "-l" (I used unused NIC vmnic9)
Command: vmkchdev -l | grep vmnic9
Pass the device from the VMkernel to passthrough/VM using the "-p" flag and specifying the PCI slot, which in this case it is 00:05:00.3
Command: vmkchdev -p 00:05:00.3
Refresh the network section so the changes are reflected in the vSphere Client by using vim-cmd
Command: vim-cmd /hostsvc/net/refresh
Device type changed from vmkernel to Passthrough. We can run the same command to list the device.
Command: vmkchdev -l | grep vmnic9
Check the NIC List using the output of esxcfg-nics and the vSphere Client, you will notice that vmnic9 is no longer listed as a vmkernel device.
Command: esxcfg-nics -l
If you would like to enable or re-present the vmnic as vmkernel device, you just need to pass the device back over to VMkernel by using the "-v" flag and refresh host network section.
Command: vmkchdev -v 00:05:00.3
Command: vim-cmd /hostsvc/net/refresh
To automatically persist this change across reboots, specifically for ESXi as changes are not saved, we need to add the following lines to /etc/rc.local which will execute the disabling of the vmnic's after bootup.
Command: vi /etc/rc.local
Edit and save the file with the below lines.
You will also need to run /sbin/auto-backup.sh to ensure the changes to /etc/rc.local are saved and reloaded upon the next reboot.
Command: /sbin/auto-backup.sh