SPAN

抓包方式:

1.集线器

2.network tap

3.span/rspan

4.vacl

idsm:可以span/rspan,vacls

nm-cids:可以router backup

杂合模式:抵达接口所有包都接收

做span考虑

1.源端口那些流量

2.源端口那个方向的流量

3.目的端口是哪

4.sensor接收不接收数据

interface:基于接口抓包

vlan:基于vlan抓包只支持rx

remote:远端设备抓包

能做几个senssion的span,2950支持1个,3550支持2个,4000/4500支持5个.

目的接口支持不支持802.1q封装

目的接口支持不支持ingress接收reset包.

show monitor session all查看所有的span

monitor session 1 source int f0/1 both(进出都抓)

monitor session 1 destination int f0/17 encapsulation dot1q ingress vlan 1

基于vlan抓包

monitor session 1 source vlan 2 , vlan 3 , vlan 4 rx

monitor session 1 destination int f0/1

reset特殊vlan

monitor session 1 source vlan  2 vlan 3 , vlan 4 rx

monitor session 1 destination int f0/1 ingress vlan 3(只reset vlan3)

reset所有vlan

monitor session 1 source vlan  2 vlan 3 , vlan 4 rx

monitor session 1 destination int f0/1 encapsulation dot1q ingress vlan 1(vlan随便敲一个存在的vlan,都可以把所有vlan reset)

虽然有dot1q和isl但是只有dot1q有效,因为ids只支持dot1q.

如果要删除span,应该no monitor session 1不能单独删除会出现问题,不是每次配置span都有效,如果无效no掉重新配置.

rspan:把远端交换机流量导入到本地

rspan需要考虑

1.源那些端口那些vlan

2.目的是哪个交换机哪个接口

3.穿越交换设备,中间穿越交换机都需要支持rspan

iso rspan限制

交换机是否支持rspan

2950:支持1个rspan

3550:支持2个rspan

只有源到目的交换机有sesson限制,中间交换机没有sesson限制,只要支持rspan.

rspan配置

swa(config)#vlan 100

swa(config-vlan)#remote-span(在vtp server创建remote-span vlan)

swa(config-vlan)#end

swa#shwo vlan remote-span

swb(config)#vlan 100

swb(config-vlan)#remote-span

swc(config)#vlan 100

swc(config-vlan)#remote-span

在所有中间设备起trunk

swa(config)#int f0/3

swa(config-if)#sw trunk en dot1q

swa(config-if)#sw mode trunk

swb(config)#int f0/1

swb(config-if)#sw trunk en dot1q

swb(config-if)#sw mode trunk

远端源rspan配置

swa(config)#monitor session 1 source int f0/2 both

swa(config)#monitor session 1 destination remote vlan 100 reflector-port f0/24(本地根本就没有用的端口作为反射,可以接senson)

swa#show monitorswc(config)#monitor session 1 source remote vlan 100

swc(config)#monitor session 1 destination int f0/2 ingress vlan 1

混合span配置

monitor session 1 source vlan 100 , 2 , 3 rx

monitor session 1 destination  int f0/17

vacl好处

1.把特定希望抓的流量抓上的

2.session 有限制,vacl没有限制

catos做span

console>(enable)set span 2/1-2 3/7 rx inpkts enable create

vacl在catos配置

console>(enable)set security acl ip test permit tcp any any eq 80 capture(capture抓包)

console>(enable)set security acl ip test permit tcp any any eq 25 capture

console>(enable)set security acl ip test permit ip

console>(enable)commit security acl test

console>(enable)set security acl map test 200(应用到相应vlan)

console>(enable)set security acl capture-ports 3/7(定义那个接口是抓包接口,默认3/7,3/7已经设置为capture接口)

vack在ios配置

router(config)#ip access-list extended web_ftp

router(config-ext-macl)#permit any any eq www

router(config-ext-macl)#permit any any eq ftp

router(config-ext-macl)#permit any any eq ftp-data

router(config)#vlan access-map ids 10

router(config-access-map)#action forward capture

router(config-access-map)#exit

router(config)#vlan access-map ids 20

router(config-access-map)#action forward

router(config)#vlan filter ids vlan-list 100,200-205

router(config)#intrusion-detection module 4 data-port 1 capture

router(config)#intrusion-detection module 4 data-port 1 capture

router(config)#ip access-list extended web_mail

router(config-ext-nacl)#permit any any eq www

router(config-ext-nacl)#permit any any eq smtp

router(config)#vlan access-map capture_web_mail 10

router(config-access-map)#match ip address web_mail

router(config-access-map)#action forward capture

router(config)#vlan access-map capture_web_mail 20

router(config-access-map)#action forward

router(config)#vlan filter capture_web_mail vlan-list 200

router(config)#intrusion-detection module 3 data-port 1 capture

catos

console>(enable)session 15

msfc>enable

msfc#conf t

msfc(config)#ip access-list extended web_mail

msfc(config-ext-nacl)#permit any any eq www

msfc(config-ext-nacl)#permit any any eq smtp

msfc(config)#interface vlan 100

msfc(config-if)#mls ip ids web_mail

console>(enable)set security acl capture 3/7

ios

router(config)#ip access-list extended web_mail

router(config-ext-nacl)#permit any any eq www

router(config-ext-nacl)#permit any any eq smtp

router(config)#int f2/1

router(config-if)#no switchport

router(config-if)#ip add 10.1.1.1 255.255.255.0

router(config-if)#mls ip ids web_mail

router(config)#intrusion-detection module 3 data-port 1 capture

catos分vlan抓包

console>(enable)clear trunk 2/7 1-1024

console>(enable)console>(enable)clear trunk 3/7 1-1024

console>(enable)set trunk 2/7 100,100

console>(enable)set trunk 3/7 300,400

ios分vlan抓包

router(config)#int g2/7

router(config-if)#switchport trunk allowed vlan 100,200

router(config)#int g3/7

router(config-if)#switchport trunk allowed vlan 300,400

command-and-control vlan on catos

console>(enable)set vlan 100 3/2

command-and-control vlan on cisco ios

router(config)#intrusion-detection module 3 management-port access-vlan 100

nm-cids模块

做span

router(config)#int f0/1

router(config-if)#ids-service-module monitoring