【RDMA】H3C交换机 抓包

摘自:https://cshihong.github.io/2020/11/20/%E5%A6%82%E4%BD%95%E5%9C%A8%E4%BA%A4%E6%8D%A2%E6%9C%BA%E4%B8%8A%E6%8A%93%E5%8C%85/

H3C交换机抓包:

在华三交换机上可使用:packet-capture 命令,在用户视图下执行。

具体操作可查看这:https://www.h3c.com/cn/d_202009/1327093_30005_0.htm

相关命令:查看端口

display interface

先停止抓包:

packet-capture stop 

进入系统视图:sys

<Device> sys

#做流统匹配抓包流量:acl http://blog.sina.com.cn/s/blog_165c04adb0102yens.html

创建acl (记得先删除之前创建的--方法见文章末尾,或者取别号码3001等)
acl advanced 3000
description test 
#rule 0 permit ip source 192.168.1.1 0 destination 192.168.2.1 0

rule 0 deny ip destination 172.16.30.0 0.0.0.255    #禁止访问30段,允许其它

rule 5 permit ip                                                       #允许所有IP数据

#rule 10 permit source-mac xxxx-xxxx-xxxx          #过滤mac,运行源macxxxx-xxxx-xxxx的数据


traffic classifier class_test operator and

if-match acl 3000

#traffic classifier c2 operator and if-match acl 3002
#流量分类器 C2 算子 如果匹配ACL 3002
#定义一个类,名为c2;报文只有匹配了访问控制列表acl 3002的规则,设备才认为报文属于这个类

#
traffic behavior behavior_test
 accounting packet # 做流量统计
 mirror-to cpu # 镜像到CPU,必须镜像到CPU才能抓包
#
qos policy policy_test
 classifier class_test behavior behavior_test
#
interface HundredGigE1/0/4
qos apply policy policy_test inbound 

检查配置状况:

display qos policy interface

退出系统视图Ctrl+Z
packet-capture local  interface  HundredGigE1/0/4  autostop  filesize  50000 write  flash:/isp1.cap

#packet-capture local interface HundredGigE1/0/4 autostop filesize 50000 write flash:/isp4.cap
packet-capture stop # 及时停止。

远程抓包:packet-capture remote  interface HundredGigE1/0/4 port 2014

需要注意的几点:

  1. 抓包时尽量使用acl匹配精确的流
  2. 在traffic behavior中,必须配置流量镜向到CPU。mirror-to cpu, 否则不能抓到包。
  3. 抓包时做好文件大小限制,autostop filesze 50000, 因为交换机的硬盘都很小,防止把交换机硬盘打满。
  4. 抓包时尽量选择流量低峰期。
  5. 配置accounting packet 流量统计后,可通过display qos policy interface 查看匹配情况。

packet-capture remote interface HundredGigE1/0/4 port 2015

display packet-capture status

删除策略

  1. 查看当前策略:

[H3C]sys

[H3C]display qos policy interface
Interface: HundredGigE1/0/4
  Direction: Inbound
  Policy: policy_test
   Classifier: class_test
     Operator: AND
     Rule(s) :
      If-match acl 3000
     Behavior: behavior_test

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值