Get a TCP Dump of a VM running on VMware vSphere

Sometimes you may have incidents that you need to examine the VMs communication to find any errors on them. This article explains how to get a TCP dump of a VM running on VMware vSphere.

Before you begin make sure you have done the steps below.

  1. If you are running in a clustered environment make sure you have created VM host rule created for the VM bound to the parent ESXi host.
  2. ESXi SSH service running status.

Then connect to ESXi host via SSH where the relevant VM is running.

Then run the command below on the ESXi shell to find the VM connected switchport ID.

net-stats -l | grep VMname

you will see the switchport ID.

Copy the switchport ID and define it in the command below.

pktcap-uw –switchport 33554493 –dir 0 -o /tmp/dumpname.pcap

After executing the command above you will see the TCP dump is starting to run and when you want to stop press Ctrl+C buttons on the keyboard. File will be saved in the /tmp folder.

Use WinSCP tool to connect to ESXi and download the TCP dump file to examine. Finally remove the VM host rule and disable SSH on the host.

Rating: 5.0/5. From 2 votes.
Please wait...

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

Get a TCP Dump of a VM running on VMware vSphere

time to read: 1 min
0