request packet-capture start
语法
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
>
描述
从操作模式捕获数据包信息。您可以从操作模式执行数据包捕获,对生产系统的影响最小,而无需提交配置。您可以根据需要定义数据包过滤器以跟踪流量类型。
您一次只能请求一个数据包捕获,并且您需要先停止每个数据包捕获请求,然后再发出另一个数据包捕获请求。对于每个数据包捕获请求,您需要提供相应的 show 命令才能查看输出。
在机箱群集模式下,您必须从主节点请求操作模式数据包捕获。从辅助节点执行时,操作模式数据包捕获不起作用。
选项
bidirectional | 允许收集双向信息。 |
capture-file | 捕获文件的名称。它生成一个pcap文件,可以通过添加后缀“.pcap”来支持Wireshark。 |
count | 要捕获的数据包数。
|
destination-port | TCP/UDP 目标端口。 |
destination-prefix | 用于过滤数据包的目标 IPv4/IPv6 地址前缀。 |
interface | 逻辑接口的名称。 |
maximum-capture-size | 数据包捕获的最大大小。如果捕获大小大于指定的捕获大小,数据包将被截断。
|
protocol-number | 数字协议值。
|
size | 数据包捕获文件的最大大小。
|
source-port | TCP/UDP 源端口。 |
source-prefix | 源 IPv4/IPv6 地址前缀以过滤数据包。 |
所需权限级别
视图
输出字段
表 1 列出了命令 request packet-capture start
的输出字段。输出字段按其出现的大致顺序列出。
字段名称 |
字段说明 |
---|---|
|
数据包捕获会话的状态:
|
|
捕获的数据包数。 |
|
数据包捕获文件的名称、位置、大小和捕获长度。 |
|
与配置的筛选器类型对应的十进制值。将此值转换为二进制或十六进制格式,例如:
例如,如果标志值为 72 = 0x48
这意味着过滤器有效,并且仅配置了过滤器源端口。 |
|
源 IPv4/IPv6 地址。 |
|
目标 IPv4/IPv6 地址。 |
|
逻辑接口的名称。 |
|
双向关键字配置的状态:
|
|
数字协议值。 |
|
捕获文件的数量。 |
|
最大数据包捕获大小。 |
|
如果接口的索引值。 |
示例输出
使用协议、目标端口、目标前缀和双向选项捕获数据包
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
使用接口捕获数据包
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
使用源前缀捕获数据包
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
使用源端口捕获数据包
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
使用协议捕获数据包
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
发布信息
Junos OS 19.3R1 版中引入的语句。