远程端口镜像(RSPAN)是本地端口镜像(SPAN)的扩展,远程端口镜像突破了源端口和目的端口必须在同一台设备上的限制,使源端口和目的端口之间可以跨越多个网络设备。这样网络管理员就可以坐在中心机房通过分析仪观测远端被镜像端口的数据报文。RSPAN实现的功能是将所有的被镜像报文通过一个特殊的RSPAN VLAN(称为Remote VLAN)传递到远端镜像设备的目的端口。
RSPAN的应用示意图如下所示
![636cb85cde9be68e9d9c3502b6a9a7ac.png](https://img-blog.csdnimg.cn/img_convert/636cb85cde9be68e9d9c3502b6a9a7ac.png)
实现了RSPAN功能的交换机分为三种
![566b651257e7aaac9976075685a58f1a.png](https://img-blog.csdnimg.cn/img_convert/566b651257e7aaac9976075685a58f1a.png)
源交换机:被监测的端口所在的交换机,负责将需要镜像的流量在Remote-probe VLAN上 做二层转发,转发给中间交换机或目的交换机。
中间交换机:网络中处于源交换机和目的交换机之间的交换机,通过Remote-probe VLAN 把镜像流量传输给下一个中间交换机或目的交换机。如果源交换机与目的交换机直接相 连,则不存在中间交换机。
目的交换机:远程镜像目的端口所在的交换机,将从Remote-probe VLAN接收到的镜像流 量通过镜像目的端口转发给监控设备。
为了实现远程端口镜像功能,需要定义一个特殊的VLAN,称之为Remote-probe VLAN。所有被镜像的报文通过该VLAN从源交换机传递到目的交换机的镜像端口,实现在目的交换机上对源交换机的远程端口的报文进行监控的功能。
Remote-probe VLAN具有以下特点:
1)建议将该VLAN中的设备互连端口都配置为Trunk端口
2)不能将缺省VLAN、管理VLAN设置成Remote-probe VLAN:需要通过配置保证 Remote-probe VLAN从源交换机到目的交换机的二层互通性
3)交换机作为中间设备或者目的设备的时候,不能支持双向(both)镜像
源交换机配置:
![29b4a804de690cdb80934440807da0c1.png](https://img-blog.csdnimg.cn/img_convert/29b4a804de690cdb80934440807da0c1.png)
中间交换机上的配置
![735e6a7c77ac4dea37eaea37f2d4c942.png](https://img-blog.csdnimg.cn/img_convert/735e6a7c77ac4dea37eaea37f2d4c942.png)
目的交换机上的配置过程
![07cd9159b08e03720ca962144b2d29e8.png](https://img-blog.csdnimg.cn/img_convert/07cd9159b08e03720ca962144b2d29e8.png)
![c861371b67a7843c7a5499825a8b1878.png](https://img-blog.csdnimg.cn/img_convert/c861371b67a7843c7a5499825a8b1878.png)
配置实例:
![ad66162792199f850e21d4db17d5f994.png](https://img-blog.csdnimg.cn/img_convert/ad66162792199f850e21d4db17d5f994.png)
![237931a0c3d97badff386c3d8af7da4c.png](https://img-blog.csdnimg.cn/img_convert/237931a0c3d97badff386c3d8af7da4c.png)
![74cdf84b47632afafc8d0977cad79cef.png](https://img-blog.csdnimg.cn/img_convert/74cdf84b47632afafc8d0977cad79cef.png)
![40680efbd8d32356ab0cb5586f1013dd.png](https://img-blog.csdnimg.cn/img_convert/40680efbd8d32356ab0cb5586f1013dd.png)
案例:
拓扑:
![8752a66d5515987a83800b6cb32bf241.png](https://img-blog.csdnimg.cn/img_convert/8752a66d5515987a83800b6cb32bf241.png)
目的交换机:
![4b2f2dc3dd6b72d7594de1358dee30c5.png](https://img-blog.csdnimg.cn/img_convert/4b2f2dc3dd6b72d7594de1358dee30c5.png)
![60e8ff1c1085816975d4c1c0dc5ddb70.png](https://img-blog.csdnimg.cn/img_convert/60e8ff1c1085816975d4c1c0dc5ddb70.png)
![09db9212402416246d0baa4dbcfec4a5.png](https://img-blog.csdnimg.cn/img_convert/09db9212402416246d0baa4dbcfec4a5.png)
中间交换机:
![3f5cdf95463bd6364d6ae2615e5a831e.png](https://img-blog.csdnimg.cn/img_convert/3f5cdf95463bd6364d6ae2615e5a831e.png)
![3418c1aebdd802362b6fa44fb1a18f4d.png](https://img-blog.csdnimg.cn/img_convert/3418c1aebdd802362b6fa44fb1a18f4d.png)
源交换机:
![45267f1f0bc12f55dfd52e8da2282264.png](https://img-blog.csdnimg.cn/img_convert/45267f1f0bc12f55dfd52e8da2282264.png)
![41b7bedc5e2474f145f0f3cad7bb72ab.png](https://img-blog.csdnimg.cn/img_convert/41b7bedc5e2474f145f0f3cad7bb72ab.png)
![d82b7c9caf3a23c0ca88bf5e90662858.png](https://img-blog.csdnimg.cn/img_convert/d82b7c9caf3a23c0ca88bf5e90662858.png)
抓包测试结果:
![03ad0f96577c69fb3a2b4aeafda778a4.png](https://img-blog.csdnimg.cn/img_convert/03ad0f96577c69fb3a2b4aeafda778a4.png)