Networking > Troubleshooting & Monitoring > Packet Capture

set capture session <session-number> [file <filename>] [file-count <file-count>] [count <packet-count>] [expression <expression>]

Start a packet capture. You must have already configured the packet capture with the set capture session <session-number> interface <port-uuid-name> direction <direction> command.

If you don't specify a file, the output displays on the terminal.

If file is specified, the file count can be specified to enable rotating capture files, where each file will be of size 100MB. Multiple files will be bundled into single tarfile.

Type Control-C to end the packet capture.

You can filter the capture using tcpdump expressions. The expression must be the last argument of the command.

Use the get capture sessions command to see all configured capture sessions.

Parameters:

Option Description
<session-number> Session ID argument in numbers
<filename> Capture file name
Allowed pattern: ^[^/ *;&|]+$
<packet-count> Packet count value greater than or equal to 1
<expression> Packet capture expression
Allowed pattern: ^.*$


Example:

nsx-edge-1> set capture session 1 count 1 expression host 192.168.130.254 and port 22 02:59:09.825531 00:50:56:8e:29:c7 > 02:50:56:00:00:01, ethertype 802.1Q (0x8100), length 78: vlan 130, p 0, ethertype IPv4, 192.168.130.254.36792 > 192.168.130.3.22: Flags [S], seq 2401912755, win 29200, options [mss 1460,sackOK,TS val 60617296 ecr 0,nop,wscale 6], length 0 nsx-edge-1> or nsx-edge-1> set capture session 1 file capturefile count 5 expression port 22 Capture 5 packets to file initiated, enter Ctrl-C to terminate before all packets captured 5 packets captured 5 packets received by filter 0 packets dropped by kernel 110 packets dropped by interface

Mode:

Basic

Availability: