Mapping VM vnic to ESXi vmnics


Esxtop is the standard way to determine what vmnic is supporting a virtual machines vnic on an ESXi hypervisor. This involves pulling up a command line interface on an ESXi server, running command esxtop, pushing the "n" key and reading the list of VMs to identify which switchport is mapped to which physical nic. I will show the screenshots to demonstrate it, however there is an alternative method. First, lets see the method I've described above. 

In this blog, were working with an ESXi server named esx-01a.corp.local.


We SSH to the server and run command "net-stats -l". Make note of the Port ID.


Next, run command "esxtop". The default view of esxtop shows cpu and process metrics. For our use case, we want to see network statistics. Push the "n" key, then locate the two Port IDs noted previously.



Alternatively, you can use the following CLI commands to find the VMs world ID (something like a process ID) and map that to a vmnic.

First we use command "esxcli vm process list" to find the VMs world ID.




 Then we feed the world ID into the command "esxcli network vm port list -w [World ID]". Notice that the output of this command also lists the Port ID of the VM and mac address of the VM in the event the VM has multiple vnics. This will allow you to differentiate the two vnics.



For some added fun, consider trying out my python script which connects to an ESXi hypervisor, lists the VMs and maps each vnic to its vmnic:

The script outputs the data to a json file. Here is an example:









Comments

Popular posts from this blog

VXLAN versus GENEVE (NSX-V vs. NSX-T)

"Twice NAT" with NSX-T T0 Gateway

Packet Capture Network Traffic Inside ESXi Hypervisor