VMware vSphere ESXi.
VMware vCenter Server.
VMware NSX.
[root@esxi:] pktcap-uw --vmk <vmk#> --ip <TARGET_IP> --dir 2 -o -|tcpdump-uw -enr -
The name of the vmk is vmk0.
The session filter IP(src or dst) address is ##.##.##.33.
pktcap: The output file is -.
pktcap: No server port specifed, select 49178 as the port.
pktcap: Local CID 2.
pktcap: Listen on port 49178.
pktcap: Main thread: 790887431360.
pktcap: Dump Thread: 790887962368.
pktcap: Recv Thread: 790888490752.
pktcap: Accept...
pktcap: The output file format is pcapng.
pktcap: Vsock connection from port 1027 cid 2.
reading from file -, link-type EN10MB (Ethernet), snapshot length 65535
03:35:42.537760 00:##:##:##:##:e7 > 00:##:##:##:##:1b, ethertype IPv4 (0x0800), length 171: ##.##.##.32 > ##.##.##.33: GREv0, seq 1315, proto unknown (0x88be), length 137: gre-proto-0x88be
03:35:42.537782 00:##:##:##:##:e7 > 00:##:##:##:##:1b, ethertype IPv4 (0x0800), length 188: ##.##.##.32 > ##.##.##.33: GREv0, seq 1316, proto unknown (0x88be), length 154: gre-proto-0x88be
03:35:42.537783 00:##:##:##:##:e7 > 00:##:##:##:##:1b, ethertype IPv4 (0x0800), length 176: ##.##.##.32 > ##.##.##.33: GREv0, seq 1317, proto unknown (0x88be), length 142: gre-proto-0x88be
03:35:42.537784 00:##:##:##:##:e7 > 00:##:##:##:##:1b, ethertype IPv4 (0x0800), length 124: ##.##.##.32 > ##.##.##.33: GREv0, seq 1318, proto unknown (0x88be), length 90: gre-proto-0x88be
Note: You won't see this traffic generated if the target server is unreachable by the desired vmk adapter.
ESXi does have an option to create a custom netstack vmk adapter for mirrored traffic through the CLI (e.g., esxcli network ip netstack add -N="mirror").
If such an adapter is used and assigned, it will replace the management adapter and must be reachable to the target.
Create a Port Mirroring Session in VMware vSphere.
Add a Port Mirroring Session in VMware NSX.