Some useful NSX CLI commands:
System related:
- ESXi build and version numbers
esxcli system version get - Show hostname:
hostname - Show host IP address:
hostname -i - date and time of when ESXi was installed.
esxcli system stats installtime get - command to put ESXi in maintenance mode or take it out
esxcli system maintenanceMode set –enable true - Use this command to reboot or shutdown ESXi. The -d parameter is a countdown timer; minimum 10 seconds. ESXi must be in maintenance mode before you can use the command.
esxcli system shutdown reboot -d 10 -r “Patch Updates” - To display the current parameters state of particular module:
esxcli system module parameters list -m ixgben - check disk space on esxi:
vdf -h
Storage section:
- The command generates a list of extents for each volume as well as the corresponding device name to UUID mapping
esxcli storage vmfs extent list - The command lists of all the volumes or datastores accessible by the ESXi host.
esxcli storage filesystem list
iSCSI section:
- Print the mappings between vmhba names and /dev names (Print HBA devices with identifying information)
esxcfg-scsidevs -a - Print the mappings between vmhba names and /dev names (Print mappings for VMFS volumes to their Service Console partitions and vmhba names.)
esxcfg-scsidevs -m | wc -l - check ...
vmkchdev -l - check...
esxcli iscsi software get List of iSCSI adaptors, UID and states:esxcli software adaptor list
- To verify that the local iSCSI initiator has been able to connect to a certain iSCSI SAN we could filter for the TCP/3260 (default port for iSCSI Target) :
esxcli network ip connection list | grep 3260 - Configuring monitoring using esxtop to monitor storage performance per HBA:
esxtop -> f (to modify fields) -> Press b, c, d, e, h, and j to toggle the fields and press Enter. -> s and 2 (to change update time)
esxcfg-mpath -b
esxcli storage core device list -d naa.xxxxxxxxxxxx
esxcli storage vmfs lockmode list
esxcli system settings advanced list --option /VMFS3/HardwareAcceleratedLocking
Network section:
- Show IP addresse for all vmk's:
esxcfg-vmknic -l
less vobd.log
esxcli network ip connections list | grep 1234
- Show all vmnic's settings:
esxcfg-nics -l - Show extended vmnic settings:
esxcli network nic get -n vmnic1 - Show all vitrual switches
esxcfg-vswitch -l - Check vmnic statistic:
esxcli network nic stats get -n vmnic2 - Displays the IPv4 configuration for all the interfaces present on ESXi
esxcli network ip interface ipv4 get
Network section (vsish):
- Show statistic on card:
cd /net/pNics/vmknic5
cat stats
Other sections:
- Search in archived logs (.gz):
zcat vmkernel.*.gz | less
zcat vmkernel.0.gz | head
zcat vmkernel.0.gz | grep -i sence | egrep -v "0x5 0x20|0x4 0x24"
zcat vobd.*.gz | grep -i
vmware -vl
VIB sections:
- Show installed VIBs:
esxcli software vib list - Uninstall VIBs:
esxcli software vib remove -n nsx-nsxv Install VIBs:esxcli software vib install -v /vmfs/volume/BronseNFS/install/VMware_bootbank_esx-nsxv_6.5.0-0.0.85...vib- Upgrade VIBs:
esxcli software vib updrade -v /vmfs/volume/BronseNFS/install/VMware_bootbank_esx-nsxv_6.5.0-0.0.85...vib
Software sections:
- Show module version:
vmkload_mod -s bnx2i | grep Version
Packet capture:
pktcap-uw --vmk vmk0 --dir 1 -o /tmp/CAPTURE.pcap
pktcap-uw --uplink vmnic3 --dir 1 -o /tmp/CAPTURE.pcap
pktcap-uw --switchport 50331657 --dir 1 -o /tmp/CAPTURE.pcap
Capture dropped packets:pktcap-uw --capture Drop --uplink vmnic7 --dir 0 -o /vmfs/volumes/XXX/tmp/CAPdc1vesx008vmnic7_in_d
- Compatability IO driver search:
vmkchdev -l | grep vmn
https://www.vmware.com/resources/compatibility/search.php?deviceCategory=io - View the current ARP table using this command:
esxcli network ip neighbor list - Description: Displays the IPv4 configuration for all the interfaces present on ESXi.
esxcli network ip interface ipv4 get
NSX related sections:
- To find the correct VIBs use URL:
https://NSX_Manager/bin/vdn/nwfabric.properties
Virtual Machine related sections:
- Lists all the running VMs on the hosts. The World ID can be used with other commands to carry out various tasks related to VMs
esxcli vm process list
