< Home

capture-packet cpu

Function

The capture-packet cpu command captures packets sent to the CPU.

Format

capture-packet cpu [ vlan vlan-id | acl { ipv4-acl | ipv6 ipv6-acl } ] * destination { file file-name | terminal } * [ time-out time-out-value | packet-num number | packet-len length ] *

Parameters

Parameter

Description

Value

vlan vlan-id

Captures packets from a specified VLAN.

The value is an integer that ranges from 1 to 4094.

acl { ipv4-acl | ipv6 ipv6-acl }

Captures packets matching a specified ACL or ACL6.

NOTE:

The specified ACL or ACL6 must exist and contain ACL rules.

The destination IPv6 address should not be specified in rules of the ACL6 for the S2720-EI, S5720I-SI, S5720-LI, S5735-L, S5735S-L, S5735S-L-M, S5720S-LI, S5720S-SI, S5720-SI, S5735-S, S5735S-S, S5735-S-I, S5730S-EI, S5730-SI, S6720-LI, S6720S-LI, S6720S-SI, or S6720-SI. Otherwise, packets will fail to be captured.

  • ipv4-acl: The value is an integer in the range from 2000 to 5999 for the S5720-EI, S5720-HI, S5730-HI, S5731-H, S5731-S, S5731S-H, S5731S-S, S5732-H, S6720-EI, S6720-HI, S6720S-EI, S6730-H, S6730S-H, S6730-S, and S6730S-S, and from 2000 to 4999 for other models.
  • ipv6 ipv6-acl: The value is an integer in the range from 2000 to 3999.

destination

Indicates the destination to which captured packet information is sent.

-

file file-name

Saves captured packet information to a file. The file name extension must be .cap.

The value is a string of 5 to 63 characters.

terminal

Displays captured packet information on a terminal.

-

time-out time-out-value

Specifies the timeout period for packet capture. The system stops capturing packets after the specified timeout period elapses.

The value is an integer that ranges from 1 to 300, in seconds. By default, the timeout period is 60s.

packet-num number

Specifies the number of packets to be captured. The system stops capturing packets after the specified number of packets are captured.

The value is an integer that ranges from 1 to 1000. The default value is 100.

packet-len length

Specifies the length of captured packets.

The value is an integer that ranges from 20 to 64, in bytes. The default value is 64 bytes.

Views

System view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

When a CPU fault occurs (for example, the CPU usage is high), configure the packet capture function to capture packets sent to the CPU for analysis. This allows the switch to process invalid packets promptly, ensuring that the CPU works properly.

Precautions

  • If the IP addresses of ARP packets on the control plane match the IP addresses in a basic or advanced ACL, these ARP packets can also be captured.
  • Running this command will increase the CPU usage. Therefore, you are not advised to run this command if the CPU usage is higher than the specified value in a Warning message.
  • The packet capture configuration is not saved in the configuration file, and becomes invalid when packet capture is complete.
  • Different packet capture instances cannot be executed simultaneously. That is, a new packet capture instance can be executed only when the previous one is complete.
  • The system limits the rate of captured packets. The default rate limit is 64 kbit/s. If the rate of packets exceeds the limit, some packets may be discarded.

Example

# Capture the packets to be sent to the CPU, save them to the abc.cap file, and display them on the terminal.
<HUAWEI> system-view
[HUAWEI] capture-packet cpu destination file flash:/abc.cap
[HUAWEI]                                                    
  Packet: 1                                                                     
  -------------------------------------------------------                       
  01 80 c2 00 00 0e 00 e0 09 87 78 90 81 00 00 01                               
  88 cc 02 07 04 00 e0 09 87 78 90 04 16 05 47 69                               
  67 61 62 69 74 45 74 68 65 72 6e 65 74 34 2f 30                               
  2f 32 36 06 02 00 78 08 15 47 69 67 61 62 69 74                               
  -------------------------------------------------------                       
                                                                                
  Packet: 2                                                                     
  -------------------------------------------------------                       
  01 80 c2 00 00 0e 00 e0 09 87 78 90 81 00 00 01                               
  88 cc 02 07 04 00 e0 09 87 78 90 04 16 05 47 69                               
  67 61 62 69 74 45 74 68 65 72 6e 65 74 34 2f 30                               
  2f 32 36 06 02 00 78 08 15 47 69 67 61 62 69 74                               
  -------------------------------------------------------                       
                                                                                
  ------------------packet getting report-----------------------                
  file: flash:/abc.cap                                                         
  packets getting: cpu                                                          
  acl: -                                                                        
  vlan: -  cvlan: -                                                             
  car: -- timeout: 60s                                                          
  packets: 100 (expected) 2 (actual)                                            
  length without tunnel header: 64 (expected)                                                         
  -------------------------------------------------------  
Table 1 Description of the capture-packet cpu command output

Item

Description

Packet: i

ith captured packet.

file

Local path that stores captured packets. If NULL is displayed, captured packets are displayed on a terminal, instead of being saved to a specified file.

packets getting

The system captures the packets to be sent to the CPU.

acl

ACL number matched by captured packets.

acl ipv6

ACL6 number matched by captured packets.

vlan

VLAN ID of captured packets.

cvlan

Inner VLAN ID of captured packets.

car

Rate of captured packets.

timeout

Timeout period of packet capture. The system stops capturing packets after the specified timeout period elapses.

packets

  • expected: number of packets expected to be captured
  • actual: actual number of captured packets

length without tunnel header

Length of captured packets, excluding the length of tunnel headers.

Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >