华为8700交换机capture-packet抓包,以及将抓包文件ftp传到外部服务器

因为业务反馈不通,需要交换机上抓包,查看流量是否发出和返回

命令: capture-packet interface xx destination [terminal |file]
可以将抓包结果直接输出到终端页面,也可以写入到文件中

第1种直接写入终端

命令:
capture-packet interface Eth-Trunk 100 acl 3003 destination terminal

因为流量较大,所以我们使用ACL匹配明细流量

acl number 3003
 rule 5 permit ip source 100.64.1.88 0 destination 100.64.2.100 0
 rule 5 permit ip source 100.64.2.100 0 destination 100.64.1.88 0 

capture-packet interface Eth-Trunk 100 acl 3003 destination terminal 

触发流量后,交换机终端可以看到输出


<8700-Stack>
packet NO        : 1
packet length is : 64
capture-time     : 2026-09-18 15:06:00.628
  L2 Type : Ethernet
    Source mac   : c0a9-1234-1234
    Dest mac     : 0000-3333-1833
    VLAN         : 1811
    Ethernet type/length : 0x0800
  L3 Type : IPv4
  Protocol Num   : 6
    Source Ip    : 100.64.1.88
    Dest Ip      : 100.64.2.100
  L4 Type : TCP
    Source Port  :20894
    Dest  Port   :8020
00 00 5E 00 18 11 C0 A9 38 03 9F DF 81 00 07 13
08 00 45 00 00 34 9B 41 40 00 7A 06 1E FF 0A 10
85 DB 0A 23 AC 75 51 9E 1F 54 1C A1 85 D9 00 00
00 00 80 02 FA F0 1A 2F 00 00 02 04 05 B4 01 03

第2种方式,抓包直接写入flash

capture-packet interface Eth-Trunk 623 acl 3003 destination file <文件名,必须以.cap结尾>

缺省情况下,保存的位置是
flash:/logfile/


<8700-Stack>capture-packet interface Eth-Trunk 623 acl 3003 destination file pd.cap 
Warning: The capture packet may disclosure the personal information.
Warning: Capture-packet data will be saved to flash:/logfile/pd.cap.

抓包完成,查看文件


<8700-Stack>dir flash:/logfile/ 
Directory of flash:/logfile/

  Idx  Attr     Size(Byte)  Date        Time       FileName                     
      302  -rw-            368  Sep 18 2026 14:53:40   pd.cap    

要将华为8700交换机flash中的文件拷贝到ftp server

交换机文件路径:flash:/logfile/pd.cap
ftp server : 10.248.133.219


这里我们指定用交换机的Ip用于连接 ftp server,因为中间有网络防火墙,只放行了 10.249.1.1 连接 ftp server


<8700-Stack>ftp -a 10.249.1.1 10.248.133.219
Warning: FTP is not secure. Using SFTP is recommended.
Trying 10.248.133.219 ...
Press CTRL + K to abort
Connected to 10.248.133.219.
220 3Com 3CDaemon FTP Server Version 2.0
User(10.248.133.219:(none)): admin  //输入ftp账号
331 User name ok, need password
Enter password:                  //输入ftp密码
230 User logged in

指定上传文件到ftp srever

[ftp]put flash:/logfile/pd.cap
Warning: The file may not transfer correctly in ASCII mode.
200 PORT command successful.
150 File status OK ; about to open data connection
/     100% [***********] 
226 Closing data connection; File transfer successful.

FTP: 368 byte(s) send in 0.030 second(s) 11.966Kbyte(s)/sec.

传输完成

posted @ 2026-09-18 15:29  JacobJacob  阅读(13)  评论(0)    收藏  举报