Récup des vmk :

esxcli network ip interface ipv4 get

Disable du firewall :

esxcli network firewall set --enabled false

iPerf en mode serveur :

/usr/lib/vmware/vsan/bin/iperf3.copy -s -B 192.168.100.1 -V
/usr/lib/vmware/vsan/bin/iperf3.copy -s -B 192.168.100.2 -V
/usr/lib/vmware/vsan/bin/iperf3  -c 192.168.100.1 -t 10 -V
/usr/lib/vmware/vsan/bin/iperf3  -c 192.168.100.2 -t 10 -V

Définir la location scratch (core dumps) :

vim-cmd hostsvc/advopt/update ScratchConfig.ConfiguredScratchLocation string "/vmfs/volumes/nas-cesium-ds/.locker-zeus"
esxcli system settings advanced set -o /UserVars/SuppressCoredumpWarning -i 1

Config des logs locaux :

esxcli system syslog config  set --logdir=/vmfs/volumes/nas-cesium-ds/.log-zeus --logdir-unique=true

Des astuces sur les VIB :

esxcli software acceptance set --level CommunitySupported
esxcli software  vib  install -d /tmp/MRVL-Atlantic-Driver-Bundle_1.0.2.0-1OEM.670.0.0.8169922-offline-bundle-16081713.zip

esxcli software sources profile list -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml | grep -i ESXi-6.7 | grep standard | sort
esxcli software profile update -p ESXi-6.7.0-20190504001-standard -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml

USB Stick ESXi avec macOS :

diskutil eraseDisk MS-DOS "ESXI" MBR diskXXX
diskutil unmountDisk /dev/diskXXX
sudo fdisk -e /dev/diskXXX
f 1
write
quit

Ensuite renommer le ISOLINUX.CFG en SYSLINUX.CFG et éditer le en rajoutant -p 1 sur la ligne APPEND -c boot.cfg

Update ESXi :

(https://tinkertry.com/easy-update-to-latest-esxi)

Par exemple (avec le numéro de build et la version, voir https://kb.vmware.com/s/article/2143832 pour le build)

esxcli software profile update -p ESXi-7.0U2c-18426014-standard -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml

Jouer avec les VM en cli :

vim-cmd -> pour avoir la liste des commandes
vim-cmd vmsvc/getallvms -> pour récup toutes les vm registered sur l'ESXi
vim-cmd vmsvc/power.on 1 -> demarrer la vm avec l'ID 1
vim-cmd vmsvc/power.getstate 1 -> récupérer l'état de la VM 1

Analyse SCSI/Stockage sur une VM :

Récupérer le worlgroup ID (id de disque virtuel) d'une vm :

vscsiStats -l

Start de collect de stats scsi du disque virtuel cible :
vscsiStats -t -s -w 966699
Sauvegarde des traces récoltées :
vscsiStats -p all -c -w 966699 > /tmp/vmstats-<vmname>.csv
Stop de la collection des stats
vscsiStats -x

Astuces VSAN :

Récupérer le master node d'un cluster VSAN :
esxcli vsan cluster get | grep 'Sub-Cluster Master UUID' | awk '{print $4}'
Lister les membres d'un cluster VSAN :
cmmds-tool find -t HOSTNAME |grep UUID (par exemple master node)
cmmds-tool find -t HOSTNAME | grep 5a79d6fe-667b-da0e-0f64-246e969b6920

Locked file (VSAN)

vim-cmd vmsvc/getallvms
vim-cmd vmsvc/snapshot.get (vmid)
vim-cmd vmsvc/snapshot.create [VmId] [snapshotName] [snapshotDescription] [includeMemory] [quiesced]
vim-cmd vmsvc/snapshot.removeall [Vmid]
vmfsfilelockinfo -p /vmfs/volumes/<UUID>/VM_name/VM_name-000001-delta.vmdk -v 192.168.x.x -u administrator@vsphere.local
Débugguer des flux réseau sous ESX avec pktcap :

Voir notamment ce billet : https://vblog.io/le-manuel-du-parfait-plombier-nsx-t-maj-continue/
D'abord extraire le numéro de port de la nic virtuelle que vous voulez pister :

chronos# net-stats -l
PortNum          Type SubType SwitchName       MACAddress         ClientName
33558533            4       0 DvsPortset-0     54:b2:03:8d:65:45  vmnic0
33558535            3       0 DvsPortset-0     54:b2:03:8d:65:46  vmk0
33558542            5       7 DvsPortset-0     00:50:56:a7:4a:d4  exo.eth0
33558543            5       7 DvsPortset-0     00:50:56:a7:22:2c  exo.eth3
33558544            5       7 DvsPortset-0     00:50:56:a7:aa:08  exo.eth1
33558545            5       7 DvsPortset-0     00:50:56:a7:de:c3  exo.eth2
33558546            5       9 DvsPortset-0     00:0c:29:5f:49:f1  titan.eth0
33558548            4       0 DvsPortset-0     54:b2:03:8d:65:46  vmnic1
33558558            5       9 DvsPortset-0     00:50:56:a5:5e:af  log.vlab.eth0
33558559            5       9 DvsPortset-0     00:50:56:a5:c5:bf  edge.eth1
33558560            5       9 DvsPortset-0     00:50:56:a5:08:19  edge.eth0
33558561            5       9 DvsPortset-0     00:0c:29:4f:7d:3a  vcenter.vlab.eth0
33558562            5       9 DvsPortset-0     00:50:56:85:0b:68  vpnchu.eth0

Ensuite lancer le pktcap :

chronos# pktcap-uw --switchport 33558562 --dir 2 -o - | tcpdump-uw -enr -
The switch port id is 0x02001022.
pktcap: The output file is -.
pktcap: No server port specifed, select 62906 as the port.
pktcap: Local CID 2.
pktcap: Listen on port 62906.
pktcap: Accept...
reading from file -, link-type EN10MB (Ethernet)
pktcap: Vsock connection from port 1032 cid 2.
21:51:51.607466 00:50:56:ba:e3:48 > 01:00:5e:7f:ff:fa, ethertype IPv4 (0x0800), length 143: 172.16.16.7.51483 > 239.255.255.250.1900: UDP, length 101
21:51:51.607518 00:50:56:ba:e3:48 > 01:00:5e:7f:ff:fa, ethertype IPv4 (0x0800), length 143: 172.16.16.7.51483 > 239.255.255.250.1900: UDP, length 101
21:51:51.677905 70:ee:50:05:4c:ea > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 60: Request who-has 172.16.16.254 tell 172.16.16.151, length 46
21:51:51.677935 70:ee:50:05:4c:ea > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 60: Request who-has 172.16.16.254 tell 172.16.16.151, length 46
21:51:51.733048 00:11:32:85:4c:41 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 60: Request who-has 172.16.16.43 tell 172.16.16.50, length 46
21:51:51.733076 00:11:32:85:4c:41 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 60: Request who-has 172.16.16.43 tell 172.16.16.50, length 46
21:51:51.812814 00:50:56:85:0b:68 > 00:50:56:a7:4a:d4, ethertype IPv4 (0x0800), length 118: 172.16.16.27.50397 > 80.82.234.188.4500: UDP-encap: ESP(spi=0x05af6f44,seq=0xa), length 76
(...)
21:51:57.087427 00:50:56:ba:e3:48 > ff:ff:ff:ff:ff:ff, ethertype IPv4 (0x0800), length 63: 172.16.16.7.49652 > 172.16.16.255.32414: UDP, length 21
21:51:57.087528 00:50:56:ba:e3:48 > ff:ff:ff:ff:ff:ff, ethertype IPv4 (0x0800), length 63: 172.16.16.7.59333 > 172.16.16.255.32412: UDP, length 21
21:51:57.087539 00:50:56:ba:e3:48 > ff:ff:ff:ff:ff:ff, ethertype IPv4 (0x0800), length 63: 172.16.16.7.59333 > 172.16.16.255.32412: UDP, length 21
21:51:57.235970 f4:5c:89:b4:63:f7 > 01:00:5e:7f:ff:fa, ethertype IPv4 (0x0800), length 217: 172.16.16.28.58719 > 239.255.255.250.1900: UDP, length 175
21:51:57.235985 f4:5c:89:b4:63:f7 > 01:00:5e:7f:ff:fa, ethertype IPv4 (0x0800), length 217: 172.16.16.28.58719 > 239.255.255.250.1900: UDP, length 175
tcpdump-uw: pcap_loop: error reading dump file: Interrupted system call
pktcap: Join with dump thread failed.
pktcap: Destroying session 4.
pktcap:
pktcap: Dumped 26 packet to file -, dropped 0 packets.
pktcap: Done.