capture

Configures onboard packet capture on the interface.

Syntax

capture packet interface ethernet IFNAME { direction [ both | rx | tx ] [packet-count number ] }
capture start
capture stop
no capture packet interface ethernet IFNAME

Parameters

interface ethernet IFNAME
Specifies the front panel port in slot/port format.
direction
Specifies the type of packet capture.
both
Specifies both ingress and egress packet capture.
rx
Specifies ingress packet capture.
tx
Specifies egress packet capture.
packet-count number
Specifies the number of packets to be captured on the interface. Valid packet capture values range from 1 to 8000.
start
Starts packet capture.
stop
Stops packet capture.

Modes

Exec mode

Usage Guidelines

This command is available only to users with admin role.

Only one mirror session is allowed per port.

Maximum 10 mirror sessions per device are allowed.

Packet capture is not allowed if maximum PCAP files are already created.

When packet-count parameter is specified, the packet capture automatically stops on the interface after the specified number of packets are captured.

The maximum number of existing PCAP files cannot exceed 25.

After packet capture is configured on the required ports, use the capture start command to start capturing packets in the active running PCAP file.

The capture stop command stops writing the packet to PCAP file and moves the active file to next available inactive PCAP file.

Start and stop options do not clear hardware entries.

Onboard packet capture is not persistent across reboot.

Table 1. Error messages
Message Reason
Max Session Per Port Exceeded  Only one port can be mentioned in the command.
Max Session Exceeded Only one mirror session is allowed on one port. A maximum of 10 mirror sessions is allowed on a device.
Interface does not exist Interface must be configured before packet capture can be configured.
Maximum limit of pcap files already created. Remove old pcap files to continue The number of existing PCAP files cannot exceed 25.
Interface range is not supported Range or list of ports are not supported.

Examples

The following example configures both ingress and egress packet capture, up to 100, on ethernet interface 1/1.

device# capture packet interface ethernet 1/1 direction both packet-count 100

The following example removes packet capture configuration on the specified ethernet slot/port.

device# no capture packet interface ethernet 1/1 

The following example starts, verifies, and stops packet capture.

device# capture start 
device# show capture packet config 
capture start
device# capture stop