Blame

cb5e9c Cédric 2025-12-23 17:45:48
1
#### Récup des vmk :
2
```shell
3
esxcli network ip interface ipv4 get
4
```
5
#### Disable du firewall :
6
```shell
7
esxcli network firewall set --enabled false
8
```
9
#### iPerf en mode serveur :
10
```shell
11
/usr/lib/vmware/vsan/bin/iperf3.copy -s -B 192.168.100.1 -V
12
/usr/lib/vmware/vsan/bin/iperf3.copy -s -B 192.168.100.2 -V
13
/usr/lib/vmware/vsan/bin/iperf3 -c 192.168.100.1 -t 10 -V
14
/usr/lib/vmware/vsan/bin/iperf3 -c 192.168.100.2 -t 10 -V
15
```
16
#### Définir la location scratch (core dumps) :
17
```shell
18
vim-cmd hostsvc/advopt/update ScratchConfig.ConfiguredScratchLocation string "/vmfs/volumes/nas-cesium-ds/.locker-zeus"
19
esxcli system settings advanced set -o /UserVars/SuppressCoredumpWarning -i 1
20
```
21
#### Config des logs locaux :
22
```shell
23
esxcli system syslog config set --logdir=/vmfs/volumes/nas-cesium-ds/.log-zeus --logdir-unique=true
24
```
25
#### Des astuces sur les VIB :
26
```shell
27
esxcli software acceptance set --level CommunitySupported
28
esxcli software vib install -d /tmp/MRVL-Atlantic-Driver-Bundle_1.0.2.0-1OEM.670.0.0.8169922-offline-bundle-16081713.zip
29
30
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
31
esxcli software profile update -p ESXi-6.7.0-20190504001-standard -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml
32
```
33
#### USB Stick ESXi avec macOS :
34
```shell
35
diskutil eraseDisk MS-DOS "ESXI" MBR diskXXX
36
diskutil unmountDisk /dev/diskXXX
37
sudo fdisk -e /dev/diskXXX
38
f 1
39
write
40
quit
41
```
42
Ensuite renommer le ISOLINUX.CFG en SYSLINUX.CFG et éditer le en rajoutant -p 1 sur la ligne APPEND -c boot.cfg
43
44
#### Update ESXi :
45
(https://tinkertry.com/easy-update-to-latest-esxi)
46
47
Par exemple (avec le numéro de build et la version, voir https://kb.vmware.com/s/article/2143832 pour le build)
48
```shell
49
esxcli software profile update -p ESXi-7.0U2c-18426014-standard -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml
50
```
51
#### Jouer avec les VM en cli :
52
```shell
53
vim-cmd -> pour avoir la liste des commandes
54
vim-cmd vmsvc/getallvms -> pour récup toutes les vm registered sur l'ESXi
55
vim-cmd vmsvc/power.on 1 -> demarrer la vm avec l'ID 1
56
vim-cmd vmsvc/power.getstate 1 -> récupérer l'état de la VM 1
57
```
58
#### Analyse SCSI/Stockage sur une VM :
59
60
##### Récupérer le worlgroup ID (id de disque virtuel) d'une vm :
61
vscsiStats -l
62
```shell
63
```
64
##### Start de collect de stats scsi du disque virtuel cible :
65
```shell
66
vscsiStats -t -s -w 966699
67
```
68
##### Sauvegarde des traces récoltées :
69
```shell
70
vscsiStats -p all -c -w 966699 > /tmp/vmstats-<vmname>.csv
71
```
72
##### Stop de la collection des stats
73
```shell
74
vscsiStats -x
75
```
76
#### Astuces VSAN :
77
78
##### Récupérer le master node d'un cluster VSAN :
79
```shell
80
esxcli vsan cluster get | grep 'Sub-Cluster Master UUID' | awk '{print $4}'
81
```
82
##### Lister les membres d'un cluster VSAN :
83
```shell
84
cmmds-tool find -t HOSTNAME |grep UUID (par exemple master node)
85
cmmds-tool find -t HOSTNAME | grep 5a79d6fe-667b-da0e-0f64-246e969b6920
86
```
87
88
Locked file (VSAN)
89
```shell
90
vim-cmd vmsvc/getallvms
91
vim-cmd vmsvc/snapshot.get (vmid)
92
vim-cmd vmsvc/snapshot.create [VmId] [snapshotName] [snapshotDescription] [includeMemory] [quiesced]
93
vim-cmd vmsvc/snapshot.removeall [Vmid]
94
vmfsfilelockinfo -p /vmfs/volumes/<UUID>/VM_name/VM_name-000001-delta.vmdk -v 192.168.x.x -u administrator@vsphere.local
95
96
```
c4fb4a Cédric 2026-02-20 10:17:55
97
98
##### Débugguer des flux réseau sous ESX avec pktcap :
376b7c Cédric 2026-02-20 10:21:20
99
Voir notamment ce billet : https://vblog.io/le-manuel-du-parfait-plombier-nsx-t-maj-continue/ \
c4fb4a Cédric 2026-02-20 10:17:55
100
D'abord extraire le numéro de port de la nic virtuelle que vous voulez pister :
50db66 Cédric 2026-02-20 10:18:49
101
c4fb4a Cédric 2026-02-20 10:17:55
102
```shell
103
chronos# net-stats -l
104
PortNum Type SubType SwitchName MACAddress ClientName
105
33558533 4 0 DvsPortset-0 54:b2:03:8d:65:45 vmnic0
106
33558535 3 0 DvsPortset-0 54:b2:03:8d:65:46 vmk0
107
33558542 5 7 DvsPortset-0 00:50:56:a7:4a:d4 exo.eth0
108
33558543 5 7 DvsPortset-0 00:50:56:a7:22:2c exo.eth3
109
33558544 5 7 DvsPortset-0 00:50:56:a7:aa:08 exo.eth1
110
33558545 5 7 DvsPortset-0 00:50:56:a7:de:c3 exo.eth2
111
33558546 5 9 DvsPortset-0 00:0c:29:5f:49:f1 titan.eth0
112
33558548 4 0 DvsPortset-0 54:b2:03:8d:65:46 vmnic1
113
33558558 5 9 DvsPortset-0 00:50:56:a5:5e:af log.vlab.eth0
114
33558559 5 9 DvsPortset-0 00:50:56:a5:c5:bf edge.eth1
115
33558560 5 9 DvsPortset-0 00:50:56:a5:08:19 edge.eth0
116
33558561 5 9 DvsPortset-0 00:0c:29:4f:7d:3a vcenter.vlab.eth0
117
33558562 5 9 DvsPortset-0 00:50:56:85:0b:68 vpnchu.eth0
118
```
119
Ensuite lancer le pktcap :
120
```shell
121
chronos# pktcap-uw --switchport 33558562 --dir 2 -o - | tcpdump-uw -enr -
122
The switch port id is 0x02001022.
123
pktcap: The output file is -.
124
pktcap: No server port specifed, select 62906 as the port.
125
pktcap: Local CID 2.
126
pktcap: Listen on port 62906.
127
pktcap: Accept...
128
reading from file -, link-type EN10MB (Ethernet)
129
pktcap: Vsock connection from port 1032 cid 2.
130
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
131
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
132
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
133
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
134
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
135
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
136
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
137
(...)
138
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
139
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
140
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
141
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
142
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
143
tcpdump-uw: pcap_loop: error reading dump file: Interrupted system call
144
pktcap: Join with dump thread failed.
145
pktcap: Destroying session 4.
146
pktcap:
147
pktcap: Dumped 26 packet to file -, dropped 0 packets.
148
pktcap: Done.
149
```