Troubleshooting VMWare Networking
To locate a VM Host on a Cisco switch, enable the sending of CDP (Cisco Discovery Protocol) packets on the VMWare host, the syntax is:
# esxcli network vswitch standard set –c both –v vSwitch# (Note: Replace # with the vSwitch number)
In ESXCLI 5.1, you can now retrieve additional network statistics at a physical NIC (vmnic), on a per VLAN (portgroup) which needs to be configured and on a per VM port (vNIC). Here is a quick diagram to help you visualize where you can retrieve network statistics:
list all available vmnics:
# esxcli network nic list
Get stats for a single vmnic:
# esxcli network nic stats get -n vmnic2
Statistics on a per portgroup (vlan) basis using the new “vlan” namespace.
NOTE: By default VLAN statistics is disabled. To enable:
# esxcli network nic vlan stats set -e true -n vmnic2
Get VLAN stats for vmnic:
# esxcli network nic vlan stats get -n vmnic2
Use “vm” namespace – list all virtual machines, ports (configured vNIC) and networks:
# esxcli network vm list
Get World ID (World ID is process ID for a given VM):
# esxcli vms vm list
Use World ID for details about the VM’s network configuration (Port ID, VSS/VDS, Portgroup, DVPort Group, MAC Address, IP Address, vmnic Uplink, Uplink ID and any active filters):
# esxcli network vm port list -w [World ID]
Note: IP Address information is made available by ARP packet inspection, which is disabled by default. To enable:
# esxcli system settings advanced set -o /Net/GuestIPHack -i 1
Now retrieve network statistics per VM port (vNIC) using new “port” namespace. (Port ID US located in previous step)
# esxcli network port stats get -p 50331660
—
source: https://blogs.vmware.com/vsphere/2013/01/network-troubleshooting-using-esxcli-5-1.html