NSX Networking
vSphere Networking
The causes are varied.
There could be issues with the protocol in use, or environmental issue with the physical infrastructure.
The rolling packet capture is a combination of ptkcap-uw
and tcpdump-uw.
Pktcap-uw is the packet capture tool. Its output is streamed to the tcpdump-uw
command which then produces the pcap files. Tcpdump-uw options are used to set the number of output files and limit the size or duration of each capture file.
This method is applicable to any networking analysis need for VMware products such as vSphere, and NSX. The object is to have a single capture running and continuously producing some number of capture files with a specific maximum file size. Each file will reach a specified size and then roll to the next file in sequence. When the maximum number of files is reached it will begin overwriting the files starting with the oldest file first. This sequence will continue until the capture is terminated.
The capture files will require a directory capable of holding several gigabytes. The capture files will consume more space than the ESXi host can provide in its /tmp directory. A directory called "captures" will need to be created on a selected shared datastore with enough storage capacity to support the capture files. Since this a directory on a shared datastore it will be created once. The datastore will be shared across all of the hosts.
cd /vmfs/volumes
ls -l #Select the datastore to create the captures directory
cd <Selected datastore>
mkdir captures
cd captures
esxcli vm process list | less
Search the list for the Virtual Machine name. Record the WID (World ID).sxcli network vm port list -w <WID>
The output for the WID will have the switchport number, uplink, and VM name.pktcap-uw
" command.The command has two parts:pktcap-uw --switchport <Switchport ID of VM> --capture VnicTx,VnicRx --ng --snaplen 150 --ip <VM IP> -o - |tcpdump-uw -W 5 -C 1000 -w <VM | Host |Componet>.switchport#-X.pcap
pktcap-uw --switchport <Switchport ID of VM> --capture VnicTx,VnicRx --ng --snaplen 150 --ip <VM IP> -o -
--capture VnicTx,VnicRx
<==Capture point. This is the vNic of the VM
--ng
<== capture file formating ng New Generation format. --snaplen 150
<== Optional The number of bytes from each packet to capture. The 150 bytes are the header information of the TCP packet. No payload data. --ip 172.21.98.5
<== Filtering for traffic with IP as source of destination -o - |tcpdump-uw -W 2 -C 1 -w <.pcapng
<== pktcap-uw output stream send to tcpdump-uw
command--switchport <switchport #> --capture VnicRX,VnicTx
--uplink vmnicX --capture UplinkSndKernel,UplinkRcvKernel
VnicRX,VnicTx
" and, "UplinkSndKernel,UplinkRcvKernel".
TCPDump and TCPDump-UW are essentially the same. The options offered by tcpdump
are the same for tcpdump-uw
.
The use of filters such as "host <IP Address>" as well as operators "and | or
" have the same syntax.
tcpdump-uw -W 5 -C 1000 -w <VM | Host |Componet>.switchport#-X.pcapng
tcpdump-uw
⇐Second capture command for the rolling capture command line.-W 2
⇐ Number of files to create-C 1
⇐ Size of files in Megabytes-w
<File Name>.pcapng ⇐ Output file that is then analyzed using Wireshark
pktcap-uw --vmk vmk4 -C 1024 -G 3600 --dir 2 -o /vmfs/volumes/datastorename/0Capture/Host_iSCSI_Capture-%m-%d-%H-%M-%S-%s.pcap
Example: Packet Capture on Vsan VMK, ICMP traffic from source IP, captured to file. Command: # pktcap-uw --vmk vmk2 --proto 0x01 --ip 192.0.0.0 -o /vmfs/volumes/vmk.pcap