This KB article outlines the procedures for identifying and validating Virtual Machine (VM) switchports and their associated physical uplinks using the ESXi Command Line Interface (CLI). These steps are essential for performing granular packet captures, analyzing real-time traffic flow, and monitoring interface statistics for troubleshooting network connectivity.
VMware NSX
VMware vSphere
Use the command 'nsxdp-cli vswitch instance list' to identify switchport ID and Uplink. In the example below UPSA-1.eth0 is connected to NSX segment. The switchport ID is 67108882 and uplink is vmnic1.
[root@esx:~] nsxdp-cli vswitch instance listDvsPortset-0 (NSX-Switch) 50 ## 00 ## ## c0 ## 24-a0 ec ## ## ## ## 48 44Total Ports:2060 Available:2045 Client PortID DVPortID MAC Uplink VID VNI vdr-vdrPort 67108879 vdrPort 02:50:56:56:44:52 vmnic1 214748#### UPSA-1.eth0 67108882 6700d4e6-5c0b-####-####-1e0f2dea0b5d 00:50:56:##:##:## vmnic1 0 65536
Use one of the following methods -
Method 1
Identify the World ID associated with the VM using 'esxcli network vm list'.
For e.g., here world ID is 3481969[root@esx:~] esxcli network vm listWorld ID Name Num Ports Networks-------- ------ --------- -------- 3481969 UPSA-1 2 dvportgroup-34,
Using world ID identify the switchport and uplink. Here switchport is 67108880 uplink is vmnic0.[root@esx:~] esxcli network vm port list -w 3481969 Port ID: 67108880 vSwitch: RegionA01-VDS8 Portgroup: dvportgroup-34 DVPort ID: 3 MAC Address: 00:50:56:##:##:## IP Address: 0.0.0.0 Team Uplink: vmnic0 Uplink Port ID: 2214592517 Active Filters:
Method 2
Identify switchport using command 'net-stats -l'.
[root@esx:~] net-stats -lPortNum Type SubType SwitchName MACAddress ClientName67108880 5 9 DvsPortset-0 00:50:56:##:##:## UPSA-1.eth167108882 5 9 DvsPortset-0 00:50:56:##:##:## UPSA-1.eth0[root@esx:~]
Run 'esxtop' and press 'n' to go to network resource screen. Look for VM name and PORT-ID TEAM-PNIC.
PORT-ID USED-BY TEAM-PNIC DNAME PKTTX/s MbTX/s PSZTX PKTRX/s MbRX/s PSZRX %DRPTX %DRPRX67108880 3481969:UPSA-1.eth1 vmnic0 DvsPortset-0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.0067108882 3481969:UPSA-1.eth0 vmnic1 DvsPortset-0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Note: To change screen refresh delay press 's' and enter the seconds.
Seconds to delay: PORT-ID USED-BY TEAM-PNIC DNAME PKTTX/s MbTX/s PSZTX PKTRX/s MbRX/s PSZRX %DRPTX %DRPRX