zoukankan      html  css  js  c++  java
  • Cisco SPAN

    交换端口分析器SPAN:端口流量的镜像。
    下图为本地SPAN。SPAN 技术应用广泛,常用于网络分析(如Sniffer分析、IDS、网络内容过滤等等)。可监控多端口、多VLAN 的流量进行监控,VLAN 监控称之为VSPAN。

    本地SPAN 配置:
    配置被监控(镜像源)端口:把这个端口镜像。注意流量方向(rx|tx)
    Switch(config)#monitor session {session_num} {source {interface type/num} | {vlan num}} [, | - | rx | tx |both]
    配置监控输出(目的)端口:镜像到这个目的端口,我们要从这个端口进行分析
    Switch(config)#monitor session {session_number} {destination {interface type/num} [, | - ] | {vlan num}}

    本地SPAN 配置实例:把fa5/2 和5/20 双向的流量镜像到fa5/10 端口上。
    switch(config)#monitor session 1 source interface fa5/2,5/20 both
    switch(config)#monitor session 1 destination interface fa 5/10
    个人观点:注意:需要考虑的是目的端口的负载,流量过大时可能会产生丢包现象。


    远程镜像(RSPAN):
    远程镜像是镜像的源端口和目的端口不在同一交换机上。如下图:A1 A2 B1-B3 五个端口为源端口,D2 为目的端口。RSPAN 必须要在每个交换机上定义一个特殊(镜像)的VLAN(RSPAN VLAN),使用RSPAN VLAN 后,所有源端口的流量复制到RSPAN VLAN上,然后复制到目的端口以进行分析。
    RSPAN 配置命令:
    定义一个RSPAN 的VLAN:
    Switch(config)#vlan vlan-number
    在这个VLAN 上启用RSPAN:
    Switch(config-vlan)#remote-span

    vlan 901
    remote-span

    source switch B:
    monitor session 2 source int f1/1
    monitor session 2 remote vlan 901

    destination swtich D
    monitor session 2 source remote vlan 901
    monitor session 2 destination f1/5 

    检验命令:如右图和左下图的两个实例
    命令为:Switch#show monitor session session_number [detail]

                         

    例子:
    sw4 fa0/18 连接到网络分析器,监控sw1 f0/10(to BB1)and sw2 fa0/1(to R1)vlan 500 name  VLAN_RSPAN.(sw1 是3550,sw2,4是3560,sw1 vtp:server sw2/sw4 vtp:client)

    SW1:
    vlan 500
    remote-span
    name VLAN_RSPAN

    no monitor session all 
    monitor session 1 source interface fa0/10 tx 
    monitor session 1 destination remote vlan 500 reflector-port fa0/16
    //3550必须用镜像端口,只要是没有用过的端口就可以,记得在fa0/16上no sh
    ==============================
    SW2:
    no monitor session all
    monitor session 1 source interface fa0/1 tx
    monitor session 1 destination remote vlan 500 //3560不用指定reflector-port
    ==============================
    SW4:
    no monitor session all
    monitor session 1 source remote vlan 500 //这里就不必用RX/TX,全部监控
    monitor session 1 destination interface fa0/18
    验证:show monitor session all 或 show monitor session 1 detail


    reflector-port: 反射端口
      反射端口只在RSPAN中使用,与RSPAN中的受控端口在同一台交换机上,是用来将本地的受控端口流量转发到RSPAN中在另一台交换机上的远程监控端口的方法,反射端口也只能是一个实际的物理端口,
      它不属于任何VLAN(It is invisible to all VLANs.)。
      RSPAN中还要使用一个专用的VLAN来转发流量,反射端口会使用这个专用VLAN将数据流通过TRUNK端口 


    =======================================
    SPAN ( 同一个交换机的 端口镜像 )
                     monitor session 1 source interface fa1/0/1 - 10
                     monitor session 1 destination interface fa1/0/24

    RSPAN:
          1.源交换机 (需要镜像的流量所在的交换机)
                    monitor session 2 source interface fa1/0/1 - 10
                    monitor session 2 destination remote vlan 999
                    vlan 999
                    remote-span
         
          2.过渡交换机
           保证存在VLAN 999即可(如果Remote SPAN VLAN >1006, 必须手工创建VLAN;  否则可以用VTP同步  )

         3.目标交换机 (嗅探设备所在的交换机)
                  monitor session 20 source remote vlan 999
                  monitor session 20 destination interface fa1/0/24



    ?
    <SPAN(Switched Port Analyzer)>交换机端口分析器可用于抓包
    ·能够将某个VLAN或一组端口的网络流量复制到指定端口中。
     而不会对源端口或VLAN的流量产生影响。
    ·SPAN支持下列三种类型流量:
    ?1、流入的流量
    ?2、流出的流量
    ?3、双向流量
    本地SPAN
    在相同的switch上配置源端口、源VLAN、和目标端口
    sw1(config)#monitor session 1 source int f0/1 (both|rx|tx)(被监控端口)
    sw1(config)#monitor session 1 destination int f0/8(接分析仪)
    sw1#show monitor session 1 detail
    注意:目标端口不能再用做其他用途
    RSPAN(Remote SPAN)
    ?
    ·支持监控不同SW的源端口或VLAN。
    sw1(config)#vlan 100
    sw1(config-vlan)#remote-span牋?设置一个span VLAN,可以通过VTP分发下去
    sw1(config)#monitor session 1 source int f0/1
    sw1(config)#monitor session 1 destination remote vlan 100 reflector-port f0/8
                                 (空接口)
    交换机间一定要Trunking
    sw2(config)#monitor session 1 source remote vlan 100
    sw2(config)#monitor session 1 destination int f0/3(接分析仪)
    ?
    现在在Cisco交换机上提出了一个新的冗余技术VSS 1440,要在6500以上的交换机才可以使用!

  • 相关阅读:
    系统设计5:Google三剑客
    lintcode亚麻九题
    设计模式17:单例模式
    设计模式16:迭代器模式
    设计模式15:组合模式
    476. Number Complement
    561. Array Partition I
    627. Swap Salary
    617. Merge Two Binary Trees
    728. Self Dividing Numbers
  • 原文地址:https://www.cnblogs.com/cyrusxx/p/12824339.html
Copyright © 2011-2022 走看看