华为、华三、锐捷、飞塔、山石的抓包命令

一、华为的抓包命令

1、基本概念

华为的抓包行为称之为镜像端口,也就是说将需要抓取的接口上(称为镜像端口)的流量复制一份到另一个接口上(工程师进行流量观察的端口,称为观察端口),如下图所示:

华为、华三、锐捷、飞塔、山石的抓包命令_第1张图片

2、华为镜像端口分类

1)、本地镜像端口(也就是观察端口和镜像端口在同一设备上),对抓取的流量不进行限制,即抓取镜像端口的所有流量;

配置:

第一步:配置观察端口

system                                                                                        //进入系统视图下

observe-port interface interface-type interface-number     //全局下配置本地观察端口

第二步:配置镜像端口

interface interface-type interface-number                                //进入观察接口视图下

mirror to observe-port { both | inbound | outbound } [ exclude-link-head ]              //将镜像端口绑定到观察端口

 { both | inbound | outbound }为流量方向 {所有方向 | 入方向 | 出方向}

[ exclude-link-head ] 表示对报文进行镜像前先去除非以太链路层信息

对于一些承载特殊链路层的IP报文(如IPOA等),镜像时可能会由于工具无法解析这些非以太链路层的信息而导致不能分析报文。通过使用exclude-link-layer参数,可以使设备去除报文中的非以太链路层信息,从而使工具可以正常分析报文。

2)、流镜像(使用traffic工具精确抓取流量),可以将流量观察端口设置在任一可以网络互通的设备接口上。

配置示例:


 本地镜像端口配置:

[SW1] observing-port 1 interface g0/0/24             //指定观察端口1为G0/24口

[SW1] interface g0/0/1                                          //进入到镜像端口视图下

[SW1-Ethernet2/0/0] mirror to observe-port 1 inbound         //将该接口的入方向流量复制一份到观察端口1上

流镜像配置:

[SW1] observing-port 1 interface g0/0/24             //指定观察端口1为G0/24口

acl number 3000                                                 //配置ACL匹配需要抓取的流量
 rule 5 permit ip source 10.0.0.0 0.0.0.255 destination 1.1.1.1 0

traffic classifier to_1.1.1.1 operator and            //配置流分类
 if-match acl 3000

traffic behavior to_1.1.1.1                                //配置流行为
 mirroring to observe-port 1

traffic policy to_1.1.1.1                                    //配置流策略
 classifier to_1.1.1.1 behavior to_1.1.1.1

interface GigabitEthernet0/0/1                         //在镜像端口应用抓取所有方向的流量
 traffic-policy to_1.1.1.1 inbound
 traffic-policy to_1.1.1.1 outbound

二、华三的抓包命令

1、基本概念

华三将镜像端口中的需要抓取流量的端口称之为源端口,将对流量进行观察的端口称为目的端口,

和华为抓包的理论逻辑类似,仅仅是配置上有细微的区别。

2、配置示例

1)、本地镜像端口

华为、华三、锐捷、飞塔、山石的抓包命令_第2张图片

mirroring-group 1 local              //系统视图下全局配置镜像组1

mirroring-group 1 mirroring-port gigabitethernet 1/0/1 gigabitethernet 1/0/2 both        //源端口为G0/1和G0/2加入到组1

mirroring-group 1 monitor-port gigabitethernet 1/0/3                //目的端口为G0/3加入到组1

 display mirroring-group all                     //验证命令

2)、远程镜像端口

华为、华三、锐捷、飞塔、山石的抓包命令_第3张图片

Device A上配置:

interface tunnel 0 mode gre                  //配置GRE隧道

ip address 50.1.1.1 24

source 20.1.1.1

destination 30.1.1.2

mirroring-group 1 local                     //镜像组1

mirroring-group 1 mirroring-port gigabitethernet 1/0/1 both     //源端口为G0/1

mirroring-group 1 monitor-port tunnel 0                                   //目的端口为tunnel 0

Device A上配置:

interface tunnel 0 mode gre                  //配置GRE隧道

ip address 50.1.1.2 24

source 30.1.1.2

destination 20.1.1.1

mirroring-group 1 local                     //镜像组1

mirroring-group 1 mirroring-port gigabitethernet 1/0/1 both            //源端口为G0/1

mirroring-group 1 monitor-port gigabitethernet 1/0/2                       //目的端口为G0/2

工作太累其它的抽空再补充。。。。。未完待续

你可能感兴趣的:(华为,抓包,镜像端口,流量抓取)