Cisco端口镜象详解spanvspanrspan.docx

上传人:b****6 文档编号:8775968 上传时间:2023-02-01 格式:DOCX 页数:11 大小:20.84KB
下载 相关 举报
Cisco端口镜象详解spanvspanrspan.docx_第1页
第1页 / 共11页
Cisco端口镜象详解spanvspanrspan.docx_第2页
第2页 / 共11页
Cisco端口镜象详解spanvspanrspan.docx_第3页
第3页 / 共11页
Cisco端口镜象详解spanvspanrspan.docx_第4页
第4页 / 共11页
Cisco端口镜象详解spanvspanrspan.docx_第5页
第5页 / 共11页
点击查看更多>>
下载资源
资源描述

Cisco端口镜象详解spanvspanrspan.docx

《Cisco端口镜象详解spanvspanrspan.docx》由会员分享,可在线阅读,更多相关《Cisco端口镜象详解spanvspanrspan.docx(11页珍藏版)》请在冰豆网上搜索。

Cisco端口镜象详解spanvspanrspan.docx

Cisco端口镜象详解spanvspanrspan

Cisco端口镜象详解(span,vspan,rspan_)

Cisco端口镜象详解(span,vspan,rspan)

一、SPAN简介

SPAN技术主要是用来监控交换机上的数据流,大体分为两种类型,本地SPAN和远程SPAN.----LocalSwitchedPortAnalyzer(SPAN)andRemoteSPAN(RSPAN),实现方法上稍有不同。

利用SPAN技术我们可以把交换机上某些想要被监控端口(以下简称受控端口)的数据流COPY或MIRROR一

份,发送给连接在监控端口上的流量分析仪,比如CISCO的IDS或是装了SNIFFER工具的PC.受控端口和

监控端口可以在同一台交换机上(本地SPAN),也可以在不同的交换机上(远程SPAN)。

二、名词解释

SPANSession--SPAN会话

SPAN会话是指一组受控端口与一个监控端口之间的数据流。

可以同时对多个端口的进入流量或是一个端

口的外出流量进行监控,也可以对VLAN内所有端口的进入流量进行监控,但不能同时对多个端口的外出

流量及VLAN的外出流量进行监控,可以对处于关闭状态的端口设置SPAN,但此时的SPAN会话是非活动,

但只要相关的接口被打开,SPAN就会变为活动的。

监控端口最好是>=受控端口的带宽,否则可能会出现丢包的情况。

SPANTraffic--SPAN的流量

使用本地SPAN可以监控所有的网络流量,包括multicast、bridgeprotocoldataunit

(BPDU),和CDP、

VTP、DTP、STP、PagP、LACPpackets.RSPAN不能监控二层协议。

TrafficTypes--流量类型

被监控的流量类型分为三种,Receive(Rx)SPAN受控端口的接收流量,Transmit(Tx)SPAN受控端口

的发送流量,Both一个受控端口的接收和发送流量。

SourcePort--SPAN会话的源端口(也就是monitoredport-即受控端口)受控端口可以是实际的物理端口、VLAN、以太通道端口组EtherChannel,物理端口可以在不同的VLAN中,

受控端口如果是VLAN则包括此VLAN中的所以物理端口,受控端口如果是以太通道则包括组成此以太通道组

的所有物理端口,如果受控端口是一个TRUNK干道端口,则此TRUNK端口上承载的所有VLAN流量都会受到监

控,也可以使用filtervlan参数进行调整,只对filtervlan中指定的VLAN数据流量做监控。

DestinationPort--SPAN会话的目的端口(也就是monitoringport-即监控端口)监控端口只能是单独的一个实际物理端口,一个监控端口同时只能在一个SPAN会话中使用,监控

端口不参与其它的二层协议如:

Layer2protocols

CiscoDiscoveryProtocol(CDP),

VLANTrunkProtocol(VTP),

DynamicTrunkingProtocol(DTP),SpanningTreeProtocol(STP),

PortAggregationProtocol(PagP),LinkAggregationControlProtocol(LACP).缺省情况下监控端口不会转发除SPANSession以外的任何其它的数据流,也可以通过设置ingress

参数,打开监控端口的二层转发功能,比如当连接CISCOIDS的时会有这种需求,此时IDS不仅要接

收SPANSession的数据流,IDS旧碓谕缰谢够嵊肫渌璞赣型ㄑ读髁浚砸蚩嗫囟丝诘?

二层转发功能。

ReflectorPort--反射端口

反射端口只在RSPAN中使用,与RSPAN中的受控端口在同一台交换机上,是用来将本地的受控端口流量

转发到RSPAN中在另一台交换机上的远程监控端口的方法,反射端口也只能是一个实际的物理端口,

它不属于任何VLAN(ItisinvisibletoallVLANs.)。

RSPAN中还要使用一个专用的VLAN来转发流量,反射端口会使用这个专用VLAN将数据流通过TRUNK端口

发送给其它的交换机,远程交换机再通过此专用VLAN将数据流发送到监控端口上的分析仪。

关于RSPANVLAN的创建,所有参与RSPAN的交换机应在同一个VTP域中,不能用VLAN1,也不能用

1002-1005,这是保留的(reservedforTokenRingandFDDIVLANs),如果是2-1001的标准VLAN,

则只要在VTPServer上创建即可,其它的交换机会自动学到,如果是1006-4094的扩展VLAN,则需要

在所有交换机上创建此专用VLAN.

反射端口最好是>=受控端口的带宽,否则可能会出现丢包的情况。

VLAN-BasedSPAN--基于VLAN的SPAN

基于VLAN的SPAN只能监控VLAN中所有活动端口接收的流量(onlyreceived(Rx)traffic),如果

监控端口属于此VLAN,则此端口不在监控范围内,VSPAN只监控进入交换机的流量,不对VLAN接口上

的路由数据做监控。

(VSPANonlymonitorstrafficthatenterstheswitch,nottrafficthatisrouted

betweenVLANs.

Forexample,ifaVLANisbeingRx-monitoredandthemultilayerswitchroutestrafficfromanotherVLANtothemonitoredVLAN,thattrafficisnotmonitoredandisnotreceived

ontheSPANdestinationport.)

三、SPAN和RSPAN与其它特性的互操作性

Routing--SPAN不监控VLAN间的路由数据;(不好理解)

Routing—IngressSPANdoesnotmonitorroutedtraffic.VSPANonlymonitorstrafficthat

enterstheswitch,nottrafficthatisroutedbetweenVLANs.Forexample,ifaVLANis

beingRx-monitoredandthemultilayerswitchroutestrafficfromanotherVLANtothe

monitoredVLAN,thattrafficisnotmonitoredandnotreceivedontheSPANdestinationport.

STP--监控端口和反射端口不会参与STP,但SPAN对受控端口的STP没有影响;

CDP--监控端口不参与CDP;

VTP--RSPANVLAN可以被修剪pruning;

VLANandtrunking--可以修改受控端口、监控端口和反射端口的VLAN和TRUNK设置,受

控端口的改变

会立即生效,而监控端口和反射端口则要在从SPAN中去除后才会生效;

EtherChannel--整个以太通道组可以做为受控端口使用,如果一个属于某个以太通道组的物理

端口被

配成了受控端口、监控端口或反射端口,则此端口会自动从以太通道组去除,当SPAN

删除后,它又会自动加入原以太通道组;

QoS--由于受QoS的策略影响,监控端口上收到的数据流会与受控端口实际的数据流不同,比

如DSCP值

被修改等;

Multicast--SPAN可以监控组播的数据流;

Portsecurity--安全端口不能做为监控端口使用;

802.1x--受控端口、监控端口和反射端口上可以设置802.1x,但有些限制。

四、SPAN和RSPAN的配置举例

SPAN的限制和缺省设置

Catalyst3550交换机上最多只能设置两个SPANSession,缺省SPAN没有使用,如果做了设置,缺省

情况下,第一个被设为受控端口的接口进出流量都会受到监控,以后再追加的受控端口只会对接收的

流量进行监控,监控端口的默认封装类型为Native,也就是没有打VLAN的标记。

1、ConfiguringSPAN--配置本地SPAN

Switch(config)#nomonitorsession1//先清除可能已经存在SPAN设置Switch(config)#monitorsession1sourceinterfacefastethernet0/10

//设定SPAN的受控端口

Switch(config)#monitorsession1destinationinterfacefastethernet0/20

//设定SPAN的监控端口

Switch#shmon

Session1

---------

Type:

LocalSession

SourcePorts:

Both:

Fa0/10//注意此处是Both

DestinationPorts:

Fa0/20

Encapsulation:

Native

Ingress:

Disabled

Switch(config)#monitorsession1sourceinterfacefastethernet0/11-13

//添加SPAN的受控端口

Switch#shmon

Session1

---------

Type:

LocalSession

SourcePorts:

RXOnly:

Fa0/11-13//注意此处是RXOnly

Both:

Fa0/10//注意此处还是Both

DestinationPorts:

Fa0/20

Encapsulation:

Native

Ingress:

Disabled

Switch(config)#monitorsession1destinationinterfacefastethernet0/20ingress

vlan5

//设定SPAN的监控端口并启用二层转发

Switch#shmon

Session1

---------

Type:

LocalSession

SourcePorts:

RXOnly:

Fa0/11-13

Both:

Fa0/10

DestinationPorts:

Fa0/20

Encapsulation:

Native

Ingress:

Enabled,defaultVLAN=5//允许正常的流量进入

Ingressencapsulation:

Native

2、VLAN-BasedSPAN--基于VLAN的SPAN

Switch(config)#nomonitorsession2Switch(config)#monitorsession2sourcevlan101-102rx

Switch(config)#monitorsession2destinationinterfacefastethernet0/30

Switch#shmonses2

Session2

---------

Type:

LocalSession

SourceVLANs:

RXOnly:

101-102//注意此处是RXOnly

DestinationPorts:

Fa0/30

Encapsulation:

Native

Ingress:

Disabled

Switch(config)#monitorsession2sourcevlan201-202rx

Switch#shmose2

Session2

---------

Type:

LocalSession

SourceVLANs:

RXOnly:

101-102,201-202//注意此处多了201-202DestinationPorts:

Fa0/30

Encapsulation:

Native

Ingress:

Disabled

3、SpecifyingVLANstoFilter

Switch(config)#nomonitorsession2Switch(config)#monitorsession2sourceinterfacefastethernet0/48rx

Switch(config)#monitorsession2filtervlan100-102//指定受控的VLAN范围

Switch(config)#monitorsession2destinationinterfacefastethernet0/30

Switch#shmonses2

Session2

---------

Type:

LocalSession

SourcePorts:

Both:

Fa0/48

DestinationPorts:

Fa0/30

Encapsulation:

Native

Ingress:

Disabled

FilterVLANs:

100-102//只监控VLAN100-102中的流量

4、ConfiguringRSPAN--配置远程RSPAN

RSPAN的Session分成RSPANSourceSession和RSPANDestinationSession两部分,

所以

相应的配置也要分别在Session的源和目的交换机上做。

4.1、首先要配置专用的RSPANVLAN

Switch(config)#vlan800

Switch(config-vlan)#remote-span

Switch(config-vlan)#end

sw1#shvlid800

VLANNameStatusPorts

----------------------------------------------------------------------------800VLAN0800activeFa0/47,Fa0/48

VLANTypeSAIDMTUParentRingNoBridgeNoStpBrdgModeTrans1Trans2--------------------------------------------------------------------800enet1008001500-----00

RemoteSPANVLAN

----------------

Enabled//注意看此处的提示

PrimarySecondaryTypePorts

---------------------------------------------------------------------------

4.2、配置RSPANSourceSession

Switch(config)#nomonitorsession1

Switch(config)#monitorsession1sourceinterfacefastethernet0/10-13

Switch(config)#monitorsession1sourceinterfacefastethernet0/15rx

Switch(config)#monitorsession1destinationremotevlan800reflector-port

fastethernet0/20

sw1#shmose1

Session1

---------

Type:

RemoteSourceSession

SourcePorts:

RXOnly:

Fa0/11-13,Fa0/15

Both:

Fa0/10

ReflectorPort:

Fa0/20

DestRSPANVLAN:

800

4.3、配置RSPANDestinationSession

Switch(config)#monitorsession1sourceremotevlan800Switch(config)#monitorsession1destinationinterfacefastethernet0/30

Switch(config)#end

sw2#shmose1

Session1

---------

Type:

RemoteDestinationSession

SourceRSPANVLAN:

800

DestinationPorts:

Fa0/30

Encapsulation:

Native

Ingress:

Disabled

(VLAN-BasedRSPAN)基于VLAN的RSPAN也和上面的方法类似,只不过受控的是整个

VLAN.

启用监控端口的二层转发以及SpecifyingVLANstoFilter的方法也和本地SPAN相同,

此处不再举例。

详见CISCOCD.

五、Catalyst4000/4500系列交换机的SPAN配置

ConfiguringSPAN

命令如下:

setspan{src_mod/src_ports|src_vlan|sc0}dest_mod/dest_port[rx|tx|both]

[inpkts{enable|disable}][learning{enable|disable}][multicast{enable|disable}][create]

setspan中的create参数用于创建多个SPANSession.

showspan

setspandisable[dest_mod/dest_port|all]

举例:

ThisexampleshowshowtoconfigureSPANsothatboththetransmitandreceive

trafficfromport2/4(theSPANsource)ismirroredonport3/6(theSPAN

destination):

Console>(enable)setspan2/43/6

//OverwrotePort3/6tomonitortransmit/receivetrafficofPort2/4

IncomingPacketsdisabled.Learningenabled.

Console>(enable)showspan

Destination:

Port3/6

AdminSource:

Port2/4

OperSource:

None

Direction:

transmit/receive

IncomingPackets:

disabled

Learning:

enabled

Filter:

-

Status:

active

----------------------------------------------Totallocalspansessions:

1

Console>(enable)

ThisexampleshowshowtosetVLAN522astheSPANsourceandport2/1asthe

SPANdestination:

Console>(enable)setspan5222/1

//OverwrotePort2/1tomonitortransmit/receivetrafficofVLAN522

IncomingPacketsdisabled.Learningenabled.Console>(enable)showspan

Destination:

Port2/1

AdminSource:

VLAN522

OperSource:

Port2/1-2

Direction:

transmit/receive

IncomingPackets:

disabled

Learning:

enabled

Filter:

-

Status:

active

----------------------------------------------Totallocalspansessions:

1

Console>(enable)

ConfiguringRSPAN

命令如下:

setvlanvlan_num[rspan]

showvlan

setrspansource{mod/ports...|vlans...}{rspan_vlan}reflectormod/port[rx|tx

|both]

[filtervlans...][create]

setrspandestination{mod_num/port_num}{rspan_vlan}[inpkts{enable|

disable}]

[learning{enable|disable}][create]

showrspan

setrspandisablesource[rspan_vlan|all]

setrspandisabledestination[mod_num/port_num|all]

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 成人教育 > 自考

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1