常用技术-CISCO-SPAN[switch port analyzer]详解
简介
Switch port Analyzer is an efficient , high performance traffic monitoring system.it duplicated network traffic to one or more monitor interfaces as it transverse the switch.
SPAN is used for troubleshooting connectivity issues and caculating network utilization and performance,among many others.
three types of SPANs on Cisco products
Local SPAN:本地接口的镜像
RSPAN:RSPAN穿越的是二层网络,所以要求源目间的设备为二层网络配置了Trunk且配置了镜像VLAN,同时放行镜像VLAN;
ERSPAN:ERSPAN对源目间的网络无较大的要求,ERSPAN的源设备需要较好的设备才能支持,目的较无太大的要求;只要源目的IP地址可以连通,即可完成配置;通过IP地址,建立GRE隧道,将流量封装到GRE隧道发向终端即可;[Catalyst 6500, 7600, Nexus, ASR1000支持ERSPAN]
配置
local SPAN:
接口->接口
monitor session 1 source interface g1/0 # 源默认即为both,还有rx, tx两种类型 monitor session 1 desination interface g1/1
VLAN->接口
monitor session 1 source vlan 2 rx # 如果抓取的是同一vlan内的流量则抓rx即可抓住所有流量 monitor session 1 destination g1/1
Destination中的一些细节
# encapsulation replicate # 应用于源接口为Trunk,且抓包想抓Trunk的封装tag时 # 默认情况下,抓包是没有trunk的tag的 monitor session 1 source interface g1/0/2 monitor session 1 destination interface g1/0/3 encapsulation replicate # encapsulation dot1q # 如果流量来自多个vlan,且想知道抓到的包具体来自哪个vlan时 # 默认情况下vlan tag是没有的 monitor session 1 source vlan 10 20 30 monitor session 1 destination interface g1/0/3 encapsulation dot1q # ingress # 应用于monitoring状态的destination,让其可以接收包;当比如IDS,判断出异常的TCP流量,其可以向网络中发送TCP-Rest,而不是仅仅能够旁观; # 默认情况下destination的端口<monitoring状态>,只发不收; monitor session 1 source interface G1/0/1 monitor session 1 destination interface g1/0/3 ingress # 将流量从G1/0/3接口直接注入 # 当针对vlan时 monitor session 1 destination interface g1/0/3 ingress vlan 10 # 将流量注入vlan10内,是有tag标记的; # 当针对trunk时 monitor session 1 source g1/0/1 # G1/0/1为trunk monitor session 1 destination interface g1/0/3 encapsulation dot1q ingress dot1q vlan 10 # 对端设备知道vlan tag,即激活了encapsulation dot1q 后,镜像发过来的tag,然后注入时,也使用相同的封装,同时设置native-vlan为10;
配置RSPAN
RSPAN的前提为,所有途径的设备间需要是二层互通,且使用Trunk互联;同时Trunk需要放行remote-span vlan 如vlan 500,途经的每个设备需要起vlan500并设置为remote-Vlan;
# 所有途径设备起remote-vlan vlan 500 remote-span ret # 退出才算完成配置 show vlan remote-span # 查看配置是否完成 # 配置起点交换机 monitor session 1 source int gi0/1 monitor session 1 destination remote vlan 500 # 配置终端交换机 monitor session 1 source remote vlan 500 monitor session 1 destination int gi0/2
配置ERSPAN
ERSPAN只要求起点终点的IP是互通的即可,但是需要注意的是,支持ERSPAN的设备并不多;
#配置起点交换机 monitor session 1 type erspan-source # session号本地有效 source interface gi1/3 rx #这个口流量的镜像 no shutdown destination erspan-id 101 #必须与终点匹配 mtu 1464 # 系统自动产生,而非手动配置 ip address 12.1.1.1 # 远端的目标地址 origin ip adress 23.1.13 # 配置发送的源,即本地的一个ip exit # 配置终点交换机 monitor session 2 type erspan-destination destination interface Gi1/2 # 从这个口送出到终端 no shutdown source erspan-id 101 # 必须与起点的相匹配 ip address 12.1.1.1 # 接收流量的地址,即本地的一个ip
end

浙公网安备 33010602011771号