270
Displaying the contents in a packet file
Task Command Remarks
Display the contents in a
packet file.
packet-capture read
filepath [
display-filter
disp-expression ] [
raw
| {
brief
|
verbose
} ] *
To stop displaying the
contents, press
Ctrl+C
.
Packet capture configuration examples
Filtering packet data to display configuration example
Network requirements
On Switch A, capture the following incoming IP packets on Ten-GigabitEthernet 1/0/1:
• Packets forwarded through the CPU.
• Packets that are sourced from 192.168.56.1 0 and forwarded through chips.
Configuration procedure
# Create an IPv4 advanced ACL to match packets that are sourced from 192.168.56.1 0.
<SwitchA> system-view
[SwitchA] acl number 3000
[SwitchA-acl-adv-3000] rule permit ip source 192.168.56.1 0
[SwitchA-acl-adv-3000] quit
# Configure a traffic behavior to mirror traffic to the CPU.
[SwitchA] traffic behavior behavior1
[SwitchA-behavior-behavior1] mirror-to cpu
[SwitchA-behavior-behavior1] quit
# Configure a traffic class to use the ACL to match traffic.
[SwitchA] traffic classifier classifier1
[SwitchA-classifier-class1] if-match acl 3000
[SwitchA-classifier-class1] quit
# Associate the traffic class with the traffic behavior in a QoS policy.
[SwitchA] qos policy user1
[SwitchA-qospolicy-user1] classifier classifier1 behavior behavior1
[SwitchA-qospolicy-user1] quit
# Apply the QoS policy to the incoming traffic of Ten-GigabitEthernet 1/0/1.
[SwitchA] interface ten-gigabitethernet 1/0/1
[SwitchA-Ten-GigabitEthernet1/0/1] qos apply policy user1 inbound
[SwitchA-Ten-GigabitEthernet1/0/1] quit
# Capture incoming traffic on Ten-GigabitEthernet 1/0/1.
[SwitchA] packet-capture interface ten-gigabitethernet 1/0/1
Capturing on 'Ten-GigabitEthernet1/0/1'
1 0.000000 192.168.56.1 -> 192.168.56.2 TCP 62 6325 > telnet [SYN] Seq=0 Win
=65535 Len=0 MSS=1460 SACK_PERM=1
2 0.000061 192.168.56.1 -> 192.168.56.2 TCP 60 6325 > telnet [ACK] Seq=1 Ack
=1 Win=65535 Len=0
3 0.024370 192.168.56.1 -> 192.168.56.2 TELNET 60 Telnet Data ...