Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

header-navigation
keyboard_arrow_up
close
keyboard_arrow_left
Junos CLI Reference
Table of Contents Expand all
list Table of Contents
file_download PDF
{ "lLangCode": "en", "lName": "English", "lCountryCode": "us", "transcode": "en_US" }
English
keyboard_arrow_right

request packet-capture start

date_range 09-Dec-23

Syntax

content_copy zoom_out_map
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.

  • Range: 10 through 1000000

  • Default: 100

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.

  • Range: 68 through 10000

  • Default: 1514

protocol-number

Numeric protocol value.

  • Range: 0 through 255

  • Default: 0

size

The maximum size of packet capture file.

  • Range: 10240 through 1073741824

  • Default: 50M

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.

Table 1: request packet-capture start Output Fields

Field Name

Field Description

packet capture is running

Status of the packet capture session:

  • 0: No packet capture is performing.

  • 1: Packet capture is performing.

counter of packet capture

Number of packets captured.

packet capture capture-file name

Name, location, size and capture length of the packet capture file.

Flag

Decimal value corresponding to the type of filter configured. Convert this value to binary or hexadecimal format such as:

  • 0x000 (No filters)

  • 0x001 (Source IP)

  • 0x002 (Destination IP)

  • 0x004 (Protocol)

  • 0x008 (Source port)

  • 0x010 (Destination port)

  • 0x040 (Filter is valid)

  • 0x200 (IPv6 Source IP)

  • 0x400 (IPv6 Destination IP)

  • 0x800 (Interface)

For example if the flag value is 72, convert it to binary or hexadecimal format:

72 = 0x48

  • 0x040 (Filter is valid)

  • 0x008 (Source port)

This means that the filter is valid and only configured with the filter source port.

Source

Source IPv4/IPv6 address.

Destination

Destination IPv4/IPv6 address.

Interface

Name of the logical interface.

bidirectional

Status of the bidirectional keyword configuration:

  • 0: Not configured.

  • 1: Configured.

Protocol

Numeric protocol value.

rotate

Number of capture files.

snap_len

The maximum packet capture size.

ifl

If index value of interface.

Sample Output

Packet capture using protocol, destination port, destination prefix, and bidirectional options

content_copy zoom_out_map
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

content_copy zoom_out_map
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

content_copy zoom_out_map
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

content_copy zoom_out_map
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

content_copy zoom_out_map
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.

footer-navigation