镜像口配置
    大多数交换机都支持镜像技术,这可以对交换机进行方便的故障诊断。我们称之为“mirroring ”或“Spanning ”。镜像是将交换机某个端口的流量拷贝到另一端口(镜像端口),进行监测。

Cisco3550可以配置2个镜像口
 
案例:将端口2~5镜像到端口6
 
1、镜像口配置
 
Switch>enable                         
Switch#conf  t                         
 
Step3: 配置镜像源,可以是端口也可以是Vlan
Switch(config)#monitor session 1 source interface gigabitEthernet 0/2 - 5 rx
上面命令最后一个参数:
both  监听双向数据,默认为both
rx    接收
tx    发送
 
Step4: 配置镜像目的端口
Switch(config)#monitor session 1 destination interface gigabitEthernet 0/6
 
Switch(config)#exit
 
Switch#wr
 
Step7:查看配置结果
Switch#show monitor
Session 1
---------
Type              : Local Session
Source Ports      :
    RX Only       : Gi0/2-5
Destination Ports : Gi0/6
    Encapsulation : Native
          Ingress : Disabled
 
Both      监听双向数据
RX Only   监听接收
Tx Only   监听发送


2、删除镜像端口
Switch#conf t
Switch(config)#no monitor session 1
Switch(config)#end

Switch#wr

Switch#show monitor
 No SPAN configuration is present in the system.

3.其他
(1)端口镜像的过滤,端口镜像是可以做Filter的。
monitor session session_number filter vlan vlan-id [, | -]
**指定源端口进入的流量中,属于哪些VLAN的可以从目的端口发出去。
(2)删除镜像
no monitor session {session_number | all | local | remote}
**session_number指定会话号,all是所有镜像,local是本地镜像,remote是远程镜像。
(3)镜像的目的端口不能正常收发数据,因此不能再作为普通端口使用,可以连接一些网络分析和安全设备,例如装有sniifer的计算机或者Cisco IDS设备。


    在交换以太网的环境下,一般两台工作站之间的通讯是不会被第三者侦听到的。在某些情况下,我们可能会需要进行这样的侦听,如