241
Capture incoming packets
on an interface.
• Save captured packets to a file:
packet-capture interface interface-type interface-number
[ capture-filter capt-expression | limit-captured-frames limit |
limit-frame-size bytes | autostop filesize kilobytes | autostop
duration seconds | autostop files numbers | capture-ring-buffer
filesize kilobytes | capture-ring-buffer duration seconds |
capture-ring-buffer files numbers ] * write filepath [ raw | { brief |
verbose } ] *
• Filter packets to display:
packet-capture interface interface-type interface-number
[ capture-filter capt-expression | display-filter disp-expression |
limit-captured-frames limit | limit-frame-size bytes | autostop
duration seconds ] * [ raw | { brief | verbose } ] *
Displaying the contents in a packet file
Display the contents in a
packet file.
packet-capture read
filepath [
verbose
]
[
display-filter
disp-expression ] [
raw
| {
brief
|
verbose
} ] *
A packet file must use
the .pcap or .pcapng
extension.
Packet capture configuration examples
Packet capture configuration example
Network requirements
As shown in Figure 23, capture the following incoming IP packets on GigabitEthernet 1/0/1:
• Packets forwarded through the CPU.
• Packets that are sourced from 192.168.56.0/24 and forwarded through chips.
Figure 23 Network diagram
SwitchA
GE1/0/2
GE1/0/1
HostA
192.168.56.1/24
Internet
HostB
192.168.56.2/24