高手指点迷津:创建本地SPAN的关键
由于RSPAN必须借助RSPAN VLAN才能实现,因此,应该在网络中为RSPAN VLAN预留少量VLAN,并且不要将接口指定至这些VLAN。RSPAN的另一个特性是可以一个输出ACL应用到SRPAN通信,从而选择性地过滤或监控指定的数据包,在RSPAN源交换机上的RSPAN VLAN中应用这些ACL。相对于SPAN来说,RSPAN复杂很多,但庆幸的是孙钰公司的网络并不是那么复杂,只是升级了一台48口的交换机。孙钰翻阅了老好人发过来的所有文档,并利用晚上的游戏时间做了充分的试验。下面是他总结出来的文档,当然他心里十分明白这份文档是老好人的心血。
需要在交换机上创建一个SPAN会话,指定源接口或者目的接口,并且在目的接口为一个网络安全设备启用流量控制。下表是创建本地SPAN会话并配置流量的步骤:
startup-config保存当前配置为了避免频繁搔扰,老好人干脆将限制到指定VLAN的SPAN源流量的步骤也给了他。下表是指定过滤VLAN步骤。
|
步骤
|
命令
|
解释
|
|
1
|
Switch#configure terminal
|
进入全局配置模式
|
|
2
|
Switch (config) # no monitor session {session_number |all |local |remote}
|
在对话中移除所有存在的SPAN配置
|
|
3
|
Switch (config) # monitor session session_number source {interface interface-id |vlan vlan-id} [, |-] [both |rx |tx]
|
指定SPAN会话和源接口(被监视接口)
|
|
4
|
Switch (config) # monitor session session_number destination{interface interface-id [,| -] [encapsulation replicate] [ingress{dot1q vlan vlan-id | isl |untagged vlan vlan-id |vlan vlan-id}]}
|
指定SPAN会话、目的接口、封装包和VLAN封装
|
|
5
|
Switch (config-if) # end
|
返回特权EXEC模式
|
|
6
|
Switch # show monitor [session session_number]
Switch # show running-config
|
校验配置
|
|
7
|
Switch # copy running-config startup-config
|
保存当前配置
|
为了避免频繁搔扰,老好人干脆将限制到指定VLAN的SPAN源流量的步骤也给了他。下表是指定过滤VLAN步骤。
|
步骤
|
命令
|
解释
|
|
1
|
Switch#configure terminal
|
进入全局配置模式。
|
|
2
|
Switch (config) # no monitor session {session_number |all |local |remote}
|
在对话中移除所有存在的SPAN配置。
|
|
3
|
Switch (config) # monitor session session_numbersource interface interface-id
|
指定源接口的特性和SPAN会话。
|
|
4
|
Switch (config) # monitor session session_number filter vlan vlan-id [,|-]
|
限制到指定VLAN的SPAN源流量。
|
|
5
|
Switch (config) # monitor session session_number destination {interface interface-id [,|-] [encapsulation replicate]}
|
指定SPAN会话和目的接口(监视接口)
|
|
6
|
Switch (config-if) # end
|
返回特权EXEC模式。
|
|
7
|
Switch # show monitor [session session_number]
Switch # show running-config
|
校验配置。
|
|
8
|
Switch # copy running-config startup-config
|
保存当前配置。
|
群里面的很多初级网管都很关注这件事,老好人干脆将自己网络中的配置用QQ抓图的方式敲到群里面,以下是一个综合例子,将用到前面所提到的各种命令。监控Trunk接口FastEtheraet4/10上的双向数据流(在该接口上承载着VLANl~ VLANl005的数据流),只监控其中VLAN10中的数据流,接口FastEthernet4/15为目的接口。具体配置方法如下:
Switch(config)# monitor session 1 source interface fastethernet 4/10
Switch(config)# monitor session 1 filter vlan 10
Switch(config)# monitor session 1 destination interface fastethernet 4/15
Switch(config)# no monitor session 1
Switch# show monitor session 2
提示:在配置镜像接口(SPAN)过程中,还应考虑到数据流量过大时,设备的处理速度及接口数据缓存的大小,要尽量减少被监控数据包的丢失。