No relevant resource is found in the selected language.

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Read our privacy policy>Search

Reminder

To have a better experience, please upgrade your IE browser.

upgrade

Command Reference

S1720, S2700, S5700, and S6720 V200R011C10

This document describes all the configuration commands of the device, including the command function, syntax, parameters, views, default level, usage guidelines, examples, and related commands.
Rate and give feedback:
Huawei uses machine translation combined with human proofreading to translate this document to different languages in order to help you better understand the content of this document. Note: Even the most advanced machine translation cannot match the quality of professional translators. Huawei shall not bear any responsibility for translation accuracy and it is recommended that you refer to the English document (a link for which has been provided).
Packet Capture Configuration Command

Packet Capture Configuration Command

NOTE:
Based on your requirements to detect failures in telecom transmission, this feature may collect or store some communication information about specific customers. Huawei cannot offer services to collect or store this information unilaterally. Before enabling the function, ensure that it is performed within the boundaries permitted by applicable laws and regulations. Effective measures must be taken to ensure that information is securely protected.

Command Support

Commands provided in this section and all the parameters in the commands are supported by all switch models by default, unless otherwise specified. For details, see specific commands.

capture-packet

Function

The capture-packet command captures service packets matching specified rules.

Format

capture-packet { interface interface-type interface-number | acl acl-number } * [ vlan vlan-id | cvlan cvlan-id ] * destination { file file-name | terminal } * [ car cir car-value | time-out time-out-value | packet-num number | packet-len length ] *

NOTE:

Only S5720EI, S5720HI, S6720EI, and S6720S-EI support the cvlan cvlan-id and car cir car-value parameters.

Parameters

Parameter

Description

Value

interface interface-type interface-number

Captures packets on a specified interface.
  • interface-type specifies the interface type.
  • interface-number specifies the interface number.

-

acl acl-number

Captures packets matching a specified ACL.

The value is an integer that ranges from 2000 to 5999 for S5720EI, S5720HI, S6720EI, and S6720S-EI, and from 2000 to 4999 for other models.

vlan vlan-id

Captures packets from a specified VLAN.

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

cvlan cvlan-id

Captures packets with a specified inner VLAN ID.

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

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.

-

car cir car-value

Specifies the rate at which packets are captured.

The value is an integer that ranges from 8 to 256, in kbit/s. The default value is 64 kbit/s.

time-out time-out-value

Specifies the timeout period for capturing packets. The system stops capturing packets after the specified timeout period expires.

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

If an error occurs in service traffic forwarding (for example, the traffic status does not match the traffic model), it is recommended that you configure the device to capture service packets for analysis so that the device can quickly identify invalid packets. This function ensures correct data transmission on the network.

Precautions

  • Currently, packets on the management interface cannot be captured.
  • The switch can capture only incoming packets and cannot capture outgoing packets.
  • 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.
  • 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.
  • The device cannot capture the packets of fast ICMP reply, BFD, 802.1ag and VBST.
  • When an S1720GFR, S1720GW, S1720GWR, S1720GW-E, S1720GWR-E, S1720X, S1720X-E, S2720EI, S2750EI, S5700LI, S5700S-LI, S5710-X-LI, S5720LI, S5720S-LI, S5720SI, S5720S-SI, S5730SI, S5730S-EI, S6720LI, S6720S-LI, S6720SI, or S6720S-SI discards the packets that it cannot forward, packets may not be captured in some situations. It is recommended that you obtain packets in other ways, such as mirroring.

Example

# Capture packets on the interface GigabitEthernet0/0/1, saves them to the capture.cap file, and display them on the terminal.

<HUAWEI> system-view
[HUAWEI] capture-packet interface gigabitethernet 0/0/1 destination file capture.cap terminal
[HUAWEI]                                                    
  Packet: 1                                                                     
  -------------------------------------------------------                       
  01 80 c2 00 00 00 00 e0 09 87 78 90 81 00 00 01                               
  00 69 42 42 03 00 00 03 02 7c 80 00 00 e0 09 87                               
  78 90 00 00 00 00 80 00 00 e0 09 87 78 90 80 23                               
  00 00 14 00 02 00 0f 00 00 00 40 00 72 67 31 00                               
  -------------------------------------------------------                       
                                                                                
  Packet: 2                                                                     
  -------------------------------------------------------                       
  01 80 c2 00 00 00 00 e0 09 87 78 90 81 00 00 01                               
  00 69 42 42 03 00 00 03 02 7c 80 00 00 e0 09 87                               
  78 90 00 00 00 00 80 00 00 e0 09 87 78 90 80 23                               
  00 00 14 00 02 00 0f 00 00 00 40 00 72 67 31 00                               
  -------------------------------------------------------

------------------packet getting report-----------------------                
  file:  flash:/capture.cap                                                    
  packets getting: interface GigabitEthernet0/0/1
  acl: -                                                                        
  vlan: -  cvlan: -                                                             
  car: 64kbps timeout: 60s                                                      
  packets: 100 (expected) 0 (actual)                                            
  length: 64 (expected)                                                        
  ------------------------------------------------------- 
Table 16-67  Description of the capture-packet command output

Item

Description

file

Local path that stores captured packets.

packets getting

Interface where packets are captured.

acl

ACL 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 interval of packet capture. The system stops capturing packets after the specified time interval.

packets

Expected number and actual number of captured packets.

length

Length of captured packets.

capture-packet cpu

Function

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

Format

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

Parameters

Parameter

Description

Value

acl acl-number

Captures packets matching a specified ACL.

The value is an integer that ranges from 2000 to 5999 for S5720EI, S5720HI, S6720EI, and S6720S-EI, and from 2000 to 4999 for other models.

vlan vlan-id

Captures packets from a specified VLAN.

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

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 capturing packets. The system stops capturing packets after the specified timeout period expires.

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, such as the CPU usage is high, configure the packet capture function to capture packets sent to the CPU for analysis. This allows the device to process invalid packets in time, 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.
  • When the CPU usage is above 80%, executing this command will keep the CPU usage increasing.
  • 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, saves 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) 0 (actual)                                            
  length: 64 (expected)                                                         
  -------------------------------------------------------  
Table 16-68  Description of the capture-packet cpu command output

Item

Description

file

Local path that stores captured packets.

packets getting

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

acl

ACL 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 interval of packet capture. The system stops capturing packets after the specified time interval.

packets

Expected number and actual number of captured packets.

length

Length of captured packets.

Translation
Download
Updated: 2019-04-18

Document ID: EDOC1000178165

Views: 42839

Downloads: 1107

Average rating:
This Document Applies to these Products
Related Documents
Related Version
Share
Previous Next