SPAN和RSPAN的設置方法

 用sniffer等監控軟件監控網絡中的流量,需要在交換設備上設置鏡像接口,下邊以cisco catalyst 35500交換機爲例設置鏡像接口和被監控的接口:

Catalyst 3550交換機上最多隻能設置兩個SPAN Session,缺省SPAN沒有使用,如果做了設置,缺省情況下,第一個被設爲受控端口的接口進出流量都會受到監控,以後再追加的受控端口只會對接收的流量進行監控,監控端口的默認封裝類型爲Native,也就是沒有打VLAN的標記。

1、Configuring SPAN--配置本地SPAN 

Switch(config)# no monitor session 1 //先清除可能已經存在SPAN設置 
Switch(config)# monitor session 1 source interface fastethernet0/10 
//設定SPAN的受控端口 
Switch(config)# monitor session 1 destination interface fastethernet0/20
 //設定SPAN的監控端口

Switch#sh mon 
Session 1 
 --------- 
Type : Local Session 
Source Ports : 
Both : Fa0/10 //注意此處是Both 
Destination Ports : Fa0/20 
Encapsulation : Native 
Ingress: Disabled 
 

Switch(config)# monitor session 1 source interface fastethernet0/11 - 13
 //添加SPAN的受控端口 
Switch#sh mon 
Session 1 
--------- 
Type : Local Session 
Source Ports : 
RX Only : Fa0/11-13 //注意此處是RX Only 
Both : Fa0/10 //注意此處還是Both 
Destination Ports : Fa0/20 
Encapsulation : Native 
Ingress: Disabled 
 

Switch(config)# monitor session 1 destination interface fastethernet0/20 ingress vlan 5
 //設定SPAN的監控端口並啓用二層轉發 

Switch#sh mon 

Session 1 
--------- 
Type : Local Session 
Source Ports : 
RX Only : Fa0/11-13 
Both : Fa0/10 
Destination Ports : Fa0/20 
Encapsulation : Native 
Ingress: Enabled, default VLAN = 5 //允許正常的流量進入 
Ingress encapsulation: Native


2、VLAN-Based SPAN--基於VLAN的SPAN 
Switch(config)# no monitor session 2 
Switch(config)# monitor session 2 source vlan 101 - 102 rx 
Switch(config)# monitor session 2 destination interface fastethernet0/30 
Switch#sh mon ses 2 
Session 2 
 --------- 
Type : Local Session 
Source VLANs : 
RX Only : 101-102 //注意此處是RX Only 
Destination Ports : Fa0/30 
Encapsulation : Native 
Ingress: Disabled 
Switch(config)# monitor session 2 source vlan 201 - 202 rx 
Switch#sh mo se 2 
Session 2 
--------- 
Type : Local Session 
Source VLANs : 
RX Only : 101-102,201-202 //注意此處多了201-202 
Destination Ports : Fa0/30 
Encapsulation : Native 
Ingress: Disabled

 
3、Specifying VLANs to Filter 
Switch(config)# no monitor session 2 
Switch(config)# monitor session 2 source interface fastethernet0/48 rx 
Switch(config)# monitor session 2 filter vlan 100 - 102 //指定受控的VLAN範圍 
Switch(config)# monitor session 2 destination interface fastethernet0/30 
Switch#sh mon ses 2 
Session 2 
 --------- 
Type : Local Session 
Source Ports : 
Both : Fa0/48 
Destination Ports : Fa0/30 
Encapsulation : Native 
Ingress: Disabled 
Filter VLANs : 100-102 //只監控VLAN100-102中的流量

4、Configuring RSPAN--配置遠程RSPAN
 
 RSPAN的Session分成RSPAN Source Session和RSPAN Destination Session兩部分,所以相應的配置也要分別在Session的源和目的交換機上做。
 
4.1、首先要配置專用的RSPAN VLAN 
Switch(config)# vlan 800 
Switch(config-vlan)# remote-span 
Switch(config-vlan)# end 
sw1#sh vl id 800
 
VLAN Name Status Ports
 
---- -------------------------------- --------- ------------------------------- 
800 VLAN0800 active Fa0/47, Fa0/48 
VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2 
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------ 
800 enet 100800 1500 - - - - - 0 0 
Remote SPAN VLAN 
---------------- 
Enabled //注意看此處的提示 
Primary Secondary Type Ports 
------- --------- ----------------- ------------------------------------------ 
4.2、配置RSPAN Source Session 
Switch(config)# no monitor session 1 
Switch(config)# monitor session 1 source interface fastethernet0/10 - 13 
Switch(config)# monitor session 1 source interface fastethernet0/15 rx 
Switch(config)# monitor session 1 destination remote vlan 800 reflector-port fastethernet0/20 
sw1#sh mo se 1
 
Session 1 
--------- 
Type : Remote Source Session 
Source Ports : 
RX Only : Fa0/11-13,Fa0/15 
Both : Fa0/10 
Reflector Port : Fa0/20 
Dest RSPAN VLAN : 800
 
4.3、配置RSPAN Destination Session
 
Switch(config)# monitor session 1 source remote vlan 800 
Switch(config)# monitor session 1 destination interface fastethernet0/30 
Switch(config)# end 
sw2#sh mo se 1 
 Session 1
 
--------- 
Source RSPAN VLAN : 800 
Destination Ports : Fa0/30 
Encapsulation : Native 
Ingress: Disabled
 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章