request packet-capture start
Syntax
request packet-capture start
<bidirectional bidirectional
> <capture-file capture-file
> <count count
> <destination-port destination-port
> <destination-prefix destination-prefix
> <interface interface
> <maximum-capture-size maximum-capture-size
> <protocol protocol-number
> <size size
> <source-port source-port
> <source-prefix source-prefix
>
Description
Captures packet information from the operational mode. You can execute the packet capture from the operational mode with minimal impact to the production system without committing the configurations. You can define the packet filter to trace the type of traffic based on your requirement.
You can request for only one packet capture at a time, and you need to stop each packet capture request before you give an another packet capture request. For each packet capture request, you need to give the respective show command to view the output.
In chassis cluster mode, you must request operational mode packet capture from the primary node. Operational mode packet capture does not function when executed from the secondary node.
Options
bidirectional | Allows to collect bidirectional information. |
capture-file | Name of the capture file. It generates a pcap file, which can support Wireshark by adding the suffix ‘.pcap’. |
count | Number of packets to capture.
|
destination-port | TCP/UDP destination port. |
destination-prefix | Destination IPv4/IPv6 address prefix to filter the packets. |
interface | Name of the logical interface. |
maximum-capture-size | The maximum size of packet capture. The packet truncates if the capture size is more than the specified capture size.
|
protocol-number | Numeric protocol value.
|
size | The maximum size of packet capture file.
|
source-port | TCP/UDP source port. |
source-prefix | Source IPv4/IPv6 address prefix to filter the packets. |
Required Privilege Level
view
Output Fields
Table 1 lists
the output fields for the request packet-capture start
command.
Output fields are listed in the approximate order in which they appear.
Field Name |
Field Description |
---|---|
|
Status of the packet capture session:
|
|
Number of packets captured. |
|
Name, location, size and capture length of the packet capture file. |
|
Decimal value corresponding to the type of filter configured. Convert this value to binary or hexadecimal format such as:
For example if the flag value is 72 = 0x48
This means that the filter is valid and only configured with the filter source port. |
|
Source IPv4/IPv6 address. |
|
Destination IPv4/IPv6 address. |
|
Name of the logical interface. |
|
Status of the bidirectional keyword configuration:
|
|
Numeric protocol value. |
|
Number of capture files. |
|
The maximum packet capture size. |
|
If index value of interface. |
Sample Output
- Packet capture using protocol, destination port, destination prefix, and bidirectional options
- Packet capture using interface
- Packet capture using source prefix
- Packet capture using source port
- Packet capture using protocol
Packet capture using protocol, destination port, destination prefix, and bidirectional options
root@host> request packet-capture start protocol 17 destination-port 53 destination-prefix 203.0.113.0 bidirectional {primary:node1} root@host> show packet-capture status packet capture is running: 1 counter of packet capture: 100 packet capture capture-file name: /var/log/packet-capture.pcap size: 52428800 rotate: 0 snap_len: 1514 bidirectional: 1 Flag: 86 Protocol: udp Source: 0.0.0.0 0.0.0.0 (port 0~65535) Destination: 203.0.113.0 255.255.255.255 (port 53~53) Interface: None ifl: 0 Flag: 77 Protocol: udp Source: 203.0.113.0 255.255.255.255 (port 53~53) Destination: 0.0.0.0 0.0.0.0 (port 0~65535) Interface: None ifl: 0
Packet capture using interface
user@host> request packet-capture start capture-file cli-e2e interface xe-1/0/2.0 user@host> show packet-capture status packet capture is running: 1 counter of packet capture: 100 packet capture capture-file name: /var/log/cli-e2e.pcap size: 52428800 rotate: 0 snap_len: 1514 bidirectional: 0 Flag: 2112 Source: 0.0.0.0 0.0.0.0 (port 0~65535) Destination: 0.0.0.0 0.0.0.0 (port 0~65535) Interface: xe-1/0/2.0 ifl: 68
Packet capture using source prefix
user@host> request packet-capture start capture-file cli-e2e source-prefix 192.0.2.0 user@host> show packet-capture status packet capture is running: 1 counter of packet capture: 100 packet capture capture-file name: /var/log/cli-e2e.pcap size: 52428800 rotate: 0 snap_len: 1514 bidirectional: 0 Flag: 65 Source: 192.0.2.0.2 255.255.255.255 (port 0~65535) Destination: 0.0.0.0 0.0.0.0 (port 0~65535) Interface: None ifl: 0
Packet capture using source port
user@host> request packet-capture start capture-file cli-e2e count 100 source-port telnet user@host> show packet-capture status packet capture is running: 1 counter of packet capture: 100 packet capture capture-file name: /var/log/cli-e2e.pcap size: 52428800 rotate: 0 snap_len: 1514 bidirectional: 0 Flag: 72 Source: 0.0.0.0 0.0.0.0 (port 23~23) Destination: 0.0.0.0 0.0.0.0 (port 0~65535) Interface: None ifl: 0
Packet capture using protocol
user@host> request packet-capture start protocol 6 user@host> show packet-capture status packet capture is running: 1 counter of packet capture: 100 packet capture capture-file name: /var/log/packet-capture.pcap size: 52428800 rotate: 0 snap_len: 1514 bidirectional: 0 Flag: 68 Protocol: tcp Source: 0.0.0.0 0.0.0.0 (port 0~65535) Destination: 0.0.0.0 0.0.0.0 (port 0~65535) Interface: None ifl: 0
Release Information
Statement introduced in Junos OS Release 19.3R1.