端口镜像spanrspan(华为)

RSPAN Remote Switched Port Analyzer,远程交换端口分析),即远程端口镜像,远程端口镜像(RSPAN)是本地端口镜像(SPAN)的扩展,突破了被镜像端口和镜像端口必须在同一台交换机上的限制,使被镜像端口和镜像,端口可以跨越网络中的多个设备,从而方便网管人员对远程交换机设备进行管理。

在我们的网络中,最为可靠的设备要数防火墙了,通过我们的精心配制安全方案,他确实能给我们带来不错的效果,但这还是远远不够的,像不经过防火前的***它还是无能为力的(来自内部网络的***、不经过防火墙直接通过电话线等上网的主机有可能就成为了别人***的跳板主机),一种叫做数据驱动式的***(内含逻辑×××),内网主机下载下来携带病毒***的文件包,还有一些加密后的***,这些都是防火墙无能为力的,这时我们可以使用一种叫做ids的检测机制,它重在检测没有什么防御功能,升级后的ids叫做ips,相比ids它重在防御,当别人***它是它会做出回应常见的ids有:hidssession-wallsnort这些都是软件,需要安装在主机上,使用起来既麻烦价格又不便宜,还有一种网络ids叫做nids,它只需要安装在网络设备上便可做到对数据的检测,但是它往往不能做到对全网信息的检测(交换机是点到点通讯),在交换机上有一种概念叫端口镜像span便可以解决这个问题。

端口镜像,需要在交换机上设置镜像的源端口(被检测数据来时所经过的端口)和目标端口(链接检测设备的端口),但这只是对检测设备所连接的交换机数据的检测,对于网络上的其他交换的数据检测我们要采用rspan(远程的交换端口分析),我们只需要在网络中心的交换机上连接一台检测设备便可以做到对全网信息的检测。

Rspan中各个交换机和交换机端口的作用:

本地端口镜像配置命令:

创建端口镜像组           

mirroring-group group-id  local

进入镜像目的端口的以太          

interface interface-type  interface-number

定义当前端口为镜像目的端口                  

monitor-port

进入镜像源端口的以太网         

interface interface-type interface-number

配置镜像源端口,同时指定被镜像报文的方向          

mirroring-port { inbound |outbound | both }

或者用这种方法:

创建端口镜像组             

mirroring-group group-id local

配置镜像目的端口

mirroring-group group-id

monitor-port monitor-port

配置镜像源端口,同时指定被镜像报文的方向         

mirroring-group group-id

mirroring-port mirroring-port-list { both | inbound | outbound }

下面是一个本地端口span镜像案例:

实验设备:

二层交换机sw

两个防火墙作pc

检测设备是一台linux主机安装有wireshark

参考配置:

linux安装一个wireshark抓包工具,当做sw上的检测设备

[sw]dis mirroring-group all

mirroring-group 1:

type: local

status: active

mirroring port:

Ethernet1/0/10  both

Ethernet1/0/20  both

monitor port: Ethernet1/0/2

pc2上建一个ftp服务器并建立用户:

[pc2]ftp server enable

[pc2]local-user user1      

[pc2-luser-user1]password 123456

[pc2-luser-user1]service-type ftp

pc1上登录pc2ftp服务器:

在检测设备上检测到登录信息:

接下来是rspan的一个小案例:

基本配置命令:

源交换机上的配置过程

创建 Remote-probe vlan                               

vlan vlan-id

定义当前VLAN Remote-probe VLAN

remote-probe vlan enable

进入与中间交换机或目的交换机相连的端口视图          

interface interface-type interface-number

配置当前端口类型为 Trunk               

port link-type trunk

port trunk permit vlan remote-probe-vlan-id

配置远程源镜像组

mirroring-group group-id remote-source

配置远程镜像源端口

mirroring-group group-id mirroring-port mirroring-port-list { inbound | outbound }

配置远程反射端口

mirroring-group group-id  reflector-port reflector-port

配置远程源镜像组的remote-probe vlan

mirroring-group group-id  remote-probe vlan   remote-probe-vlan-id

中间交换机配置过程:

创建 Remote-probe vlan

vlan vlan-id

定义当前VLAN Remote-probe VLAN

remote-probe vlan enable

进入与中间交换机或目的交换机相连的端口视图          

interface interface-type interface-number

配置当前端口类型为 Trunk               

port link-type trunk

port trunk permit vlan remote-probe-vlan-id

目的交换机上配置过程:

创建 Remote-probe vlan

vlan vlan-id

定义当前VLAN Remote-probe VLAN

remote-probe vlan enable

进入与中间交换机或目的交换机相连的端口视图          

interface interface-type interface-number

配置当前端口类型为 Trunk               

port link-type trunk

port trunk permit vlan remote-probe-vlan-id

配置远程目的镜像组

mirroring-group group-id remote-destination

配置远程镜像目的端口

mirroring-group group-id monitor-port monitor-port

配置远程源镜像组的 remote-probe vlan

mirroring-group group-id  remote-probe vlan   remote-probe-vlan-id

实验拓扑:

实验目的:

检测设备能检测到pc1访问pc2的数据

参考配置:

目的交换机:

 

 

 

中间交换机:

 

源交换机:

抓包测试结果: