Complete these steps in order to configure the packet capture feature on the ASA with the CLI:
Configure the inside and outside interfaces as illustrated in the network diagram with the correct IP address and security levels.
Start the packet capture process with the capture command in privileged EXEC mode. In this configuration example, the capture named capin is defined. Bind it to the inside interface, and specify with the match keyword that only the packets that match the traffic of interest are captured:
ASA# capture capin interface inside match ip 192.168.10.10 255.255.255.255
203.0.113.3 255.255.255.255
Similarly, the capture named capout is defined. Bind it to the outside interface, and specify with the match keyword that only the packets that match the traffic of interest are captured:
ASA# capture capout interface outside match ip 192.168.10.10 255.255.255.255
203.0.113.3 255.255.255.255
The ASA now begins to capture the traffic flow between the interfaces. In order to stop the capture at anytime, enter the no capture command followed by the capture name.
Here is an example:
no capture capin interface inside
no capture capout interface outside
Available Capture Types on the ASA
This section describes the different types of captures that are available on the ASA.
asa_dataplane - Captures packets on the ASA backplane that pass between the ASA and a module that uses the backplane, such as the ASA CX or IPS module.
ASA# cap asa_dataplace interface asa_dataplane
ASA# show capture
capture asa_dataplace type raw-data interface asa_dataplane [Capturing - 0 bytes]
asp-drop drop-code - Captures packets that are dropped by the accelerated security path. The drop-code specifies the type of traffic that is dropped by the accelerated security path.
ASA# capture asp-drop type asp-drop acl-drop
ASA# show cap
ASA# show capture asp-drop
2 packets captured
1: 04:12:10.428093 192.168.10.10.34327 > 10.94.0.51.15868: S
2669456341:2669456341(0) win 4128 <mss 536> Drop-reason: (acl-drop) Flow is denied by configured rule
2: 04:12:12.427330 192.168.10.10.34327 > 10.94.0.51.15868: S
2669456341:2669456341(0) win 4128 <mss 536> Drop-reason: (acl-drop) Flow is denied by configured rule
2 packets shown
ASA# show capture asp-drop
2 packets captured
1: 04:12:10.428093 192.168.10.10.34327 > 10.94.0.51.15868: S
2669456341:2669456341(0) win 4128 <mss 536> Drop-reason: (acl-drop) Flow is denied by configured rule
2: 04:12:12.427330 192.168.10.10.34327 > 10.94.0.51.15868: S
2669456341:2669456341(0) win 4128 <mss 536> Drop-reason: (acl-drop) Flow is denied by configured rule
2 packets shown
ethernet-type type - Selects an Ethernet type to capture. Supported Ethernet types include 8021Q, ARP, IP, IP6, LACP, PPPOED, PPPOES, RARP, and VLAN.
real-time - Displays the captured packets continuously in real-time. In order to terminate a real-time packet capture, press Ctrl-C. In order to permanently remove the capture, use the no form of this command.
This option is not supported when you use the cluster exec capture command.
ASA# cap capin interface inside real-time
Warning: using this option with a slow console connection may
result in an excessive amount of non-displayed packets
due to performance limitations.
Use ctrl-c to terminate real-time capture
Trace - Traces the captured packets in a manner similar to the ASA packet tracer feature.
ASA#cap in interface Webserver trace match tcp any any eq 80
// Initiate Traffic
1: 07:11:54.670299 192.168.10.10.49498 > 198.51.100.88.80: S
2322784363:2322784363(0) win 8192 <mss 1460,nop,wscale 2,nop,nop,sackOK>
Phase: 1 Type: CAPTURE
Subtype:
Result: ALLOW
Config:
Additional Information:
MAC Access list
Phase: 2 Type: ACCESS-LIST
Subtype:
Result: ALLOW
Config:
Implicit Rule
Additional Information:
MAC Access list
Phase: 3 Type: ROUTE-LOOKUP
Subtype: input
Result: ALLOW
Config:
Additional Information:
in 0.0.0.0 0.0.0.0 outside
Phase: 4 Type: ACCESS-LIST
Subtype: log
Result: ALLOW
Config:
access-group any in interface inside
access-list any extended permit ip any4 any4 log
Additional Information:
Phase: 5 Type: NAT
Subtype:
Result: ALLOW
Config:
object network obj-10.0.0.0
nat (inside,outside) dynamic interface
Additional Information:
Dynamic translate 192.168.10.10/49498 to 203.0.113.2/49498
Phase: 6 Type: NAT
Subtype: per-session
Result: ALLOW
Config:
Additional Information:
Phase: 7 Type: IP-OPTIONS
Subtype:
Result: ALLOW
Config:
Additional Information:
Phase: 8 Type:
Subtype:
Result: ALLOW
Config:
Additional Information:
Phase: 9 Type: ESTABLISHED
Subtype:
Result: ALLOW
Config:
Additional Information:
Phase: 10 Type:
Subtype:
Result: ALLOW
Config:
Additional Information:
Phase: 11 Type: NAT
Subtype: per-session
Result: ALLOW
Config:
Additional Information:
Phase: 12 Type: IP-OPTIONS
Subtype:
Result: ALLOW
Config:
Additional Information:
Phase: 13 Type: FLOW-CREATION
Subtype:
Result: ALLOW
Config:
Additional Information:
New flow created with id 41134, packet dispatched to next module
Phase: 14 Type: ROUTE-LOOKUP
Subtype: output and adjacency
Result: ALLOW
Config:
Additional Information:
found next-hop 203.0.113.1 using egress ifc outside
adjacency Active
next-hop mac address 0007.7d54.1300 hits 3170 Result:
output-interface: outside
output-status: up
output-line-status: up
Action: allow
These are advanced settings that can be configured with Packet Captures.
Please review the command reference guide on how to set them.
ikev1/ikev2 - Captures only Internet Key Exchange Version 1 (IKEv1) or IKEv2 protocol information.
isakmp - Captures Internet Security Association and Key Management Protocol (ISAKMP) traffic for VPN connections. The ISAKMP subsystem does not have access to the upper-layer protocols. The capture is a pseudo capture, with the physical, IP, and UDP layers combined together in order to satisfy a PCAP parser. The peer addresses are obtained from the SA exchange and are stored in the IP layer.
lacp - Captures Link Aggregation Control Protocol (LACP) traffic. If configured, the interface name is the physical interface name. This is useful when you work with Etherchannels in order to identify the present behavior of LACP.
tls-proxy - Captures decrypted inbound and outbound data from the Transport Layer Security (TLS) proxy on one or more interfaces.
webvpn - Captures WebVPN data for a specific WebVPN connection.
View the Captured Packets
On the ASA
In order to view the captured packets, enter the show capture command followed by the capture name. This section provides the show command outputs of the capture buffer contents.
The show capture capin command shows the contents of the capture buffer named capin:
In order to clear the capture buffer, enter the clear capture <capture-name> command:
ASA# show capture
capture capin type raw-data interface inside [Capturing - 8190 bytes] match icmp any any
capture capout type raw-data interface outside [Capturing - 11440 bytes] match icmp any any
ASA# clear cap capin
ASA# clear cap capout
ASA# show capture
capture capin type raw-data interface inside [Capturing - 0 bytes] match icmp any any
capture capout type raw-data interface outside [Capturing - 0 bytes] match icmp any any
Enter the clear capture /all command in order to clear the buffer for all captures:
ASA# clear capture /all
Stop a Capture
The only way to stop a capture on the ASA is to disable it completely with this command: