主页 > 网络教程 >

Cisco端口镜像设置实现网络旁路监控

网络教程 2016-05-22

介绍如何设备Cisco交换机路由器搭配Panabit完成网络旁路监控。

 


网络环境:

  1、公司网络下面防火墙下接入3层CISCO switch,现在需要针对主交换机进行端口镜像实现端口监控。

 


  2、fa0/39为监控机器的网络端口,fa0/41为被监视的端口(可以理解为全局网络出入端口)

 

Cisco端口镜像设置实现网络旁路监控
Cisco端口镜像设置实现网络旁路监控
 

 


操作步骤:

  进入交换机配置可以多种选择,为了方便,个人使用telnet进行网络配置

  打开命令提示符,操作如下:

telnet ——为主交换机IP地址,输入密码进入用户模式

switch>enable——进入特权模式

switch#config terminal——进入全局设置模式

switch(config)#mirror session 1 destination interface fa0/39 ——镜像目的端口fa0/39(监控端口)

switch(config)#mirror session 1 source interface fa0/41——镜像源端口(被监控的端口)fa0/41

 

(config)#exit

(config)#write 保存配置

(config)#show run 查看最后一项,可看到已经为监控模式

 


  现在我们把Panabit主机接到fa0/39端口上,现在就可以监控全网信息了。

  旁路监控的好处在于不用变更现在网络架构。

 


Cisco各种型号交换机mirror 方法

1。Cat2900XL/3500XL
  2900XL(config)#interface fastethernet 0/24 //进入接口配置模式下
  2900XL(config)#port monitor fastethernet 0/1 //配置f0/1为被监视得端口
  2900XL(config)#port monitor fastethernet 0/2 //配置f0/2为被监视得端口
  通过上面得配置就可以把进出f0/1和f0/2两个端口得流量镜像到f0/24
  通过
  show port monitor可以参看交换机得SPAN配置情况
  2。Cat2950/3550/3750
  3550(config)#monitor session 1 source interface f0/1 - 3 rx
  //指定SPAN session组号为1,源端口为f0/1-f0/3,对进这三个端口的流量
  //rx-->指明是进端口得流量,tx-->出端口得流量 both 进出得流量
  3550(config)#monitor session 1 destination interface f0/4
  //指定监视端口为f0/4
  3。Cat4000/6500 with CatOS
  set span命令
  cat4k#set span 1/2 1/3 //把1/2得流量镜像到1/3

cat4k#set span disable //關閉鏡像mirror
  4。Cat4500/6500 with IOS
  同2--Cat2950/3550/3750
  方法四:VACL
  VACL=VLAN ACL=Security ACL
  只能在Cat6500上使用
  CatOS:
  c6509 (enable) set security acl ip MyCap permit tcp any any eq 443
  c6509 (enable) set security acl ip MyCap permit tcp any eq 443 any
  c6509 (enable) set security acl ip MyCap permit ip any any capture
  //排除所有访问443端口的流量,其他流量都是感兴趣的
  c6509 (enable) commit security acl MyCap
  //定义一个security ACL的name
  c6509 (enable) set security acl map MyCap 100,101
  //把security ACL应用到vlan 100和101上
  c6509 (enable) set security acl capture-ports 3/1
  //把capture的流量镜像到3/1端口上
  IOS:
  c6509(config)# Access-list 100 permit ip any any
  c6509(config)# vlan access-map MyCap 10
  c6509(config-access-map)# match ip address 100
  c6509(config-access-map)# action forward capture
  c6509(config)# vlan filter MyCap vlan-list 200 , 201
  c6509(config)# interface gi3/1
  c6509(config-if)# switchport capture

 

端口镜像的别名
端口镜像通常有以下几种别名:
●Port Mirroring
通常指允许把一个端口的流量复制到另外一个端口,同时这个端口不能再传输数据。
●Monitoring Port
监控端口
●Spanning Port
通常指允许把所有端口的流量复制到另外一个端口,同时这个端口不能再传输数据。
●SPAN port
在 Cisco 产品中,SPAN 通常指 Switch Port ANalyzer。某些交换机的 SPAN 端口不支持传输数据。
●Link Mode port
支持端口镜像的交换机和路由
大多数中档以上的交换机都支持端口镜像功能,部分路由支持端口镜像但支持程度不同。
端口镜像配置方法
下面是几种交换机和海蜘蛛路由端口镜像配置方法,主要来自于 Talisker Security Wizardry (http://www.securitywizardry.com/) 的 Switch Port Mirroring (http://www.securitywizardry.com/switch.htm)
Cisco 交换机
特点:●Cisco 2900 和 Cisco 3500XL 系列交换机
Cisco 2950、Cisco 3550 和 Cisco 3750 系列交换机
Cisco catylist 2550 Cisco catylist 3550 支持2组monitor session en password config term
Switch(config)#monitor session 1 destination interface fast0/4(1为session id,id范围为1-2)
Switch(config)#monitor session 1 source interface fast0/1 , fast0/2 , fast0/3 (空格,逗号,空格)
Switch(config)#exit
Switch#copy running-conf startup-conf
Switch#show port-monitor
Cisco 5000 系列交换机
使用 CatOS 的 Cisco 4000 和 Cisco 6000 系列交换机
使用 IOS 的 Cisco 4000 和 Cisco 6000 系列交换机
Extreme 交换机
特点:
●只能创建多对一或者一对一的镜像端口
●可以监听 VLAN 的流量
●Extreme 会镜像 IN 和 OUT 的流量。这就意味着在镜像 VLAN 的时候,会看到一个报文至少两次— —从 VLAN 的某个端口出来,并且进入 VLAN 的另一个端口。
版本高于4.1的 Extreme 交换机端口镜像配置方法
{enable | disable} mirroring on port
开启/关闭端口镜像功能,并且指定镜像流量从何端口流出,port-no 只能是一个端口
configure mirroring { add | delete } { vlan | port }
指定镜像哪个或哪些 VLAN 或端口的流量 { vlan | port } 部分可以重复多次
版本低于 4.1 的 Extreme 交换机端口镜像配置方法
enable mirror to port port-no
开启端口镜像功能,并且指定镜像流量从何端口流出,port-no 只能是一个端口
disable mirror
关闭端口镜像功能
config mirror add port 镜像端口 port-no 的流量,如果这个端口包含多个 VLAN 这些流量都会被镜像到目的端口
config mirror add port vlan
镜像端口 port-no 中指定 VLAN 的流量
config mirror add vlan
镜像端口中指定 VLAN 的所有端口的流量
config mirror del port
取消对 port-no 的端口镜像
config mirror del vlan
取消对指定 VLAN 的端口镜像
show mirror
显示端口镜像情况
Foundry 交换机 特点:
●可以创建多对多的端口镜像
Foundry 交换机端口镜像配置方法
在配置模式中(Configuration Mode):
interface
port monitor { { rx | tx | both}}
确定镜像流量从哪个端口流出,修改此端口配置
指定要镜像哪些端口的哪些流量(rx 指接收的流量,tx 指发送的流量,both 指双向流量),{ { rx | tx | both}} 部分可以重复
Juniper 交换机
特点:
●每交换机只能有一个监听端口
●只能镜像 IPv4 的流量
●只能镜像发送(transit only)的流量,不能镜像接收的流量
Juniper M 系列和 T 系列端口镜像配置方法
usen@router# show forwarding-options port- mirroring { input {family inet; rate ; run- length ;} output interface {next-hop
;} no-filter-check;} }
选择将抽样的流量发送到哪个目的端口
user@router# show firewall filter mirror-sample from {...} then {sample; accept;}
定义抽样过滤器,选择感兴趣的流量
user@router# show interface unit 0 family inet filter {input mirror-sample;}
选择将抽样的过滤器应用到某个端口
海蜘蛛路由端口镜像设置是WEB控制非常方便,在这里我就不详细说明(防火墙--->端口镜像)
端口镜像的风险
加重交换机负载,造成设备不稳定
在某些情况下会丢包,不能保证 100% 镜像流量。例如,由于多个源端口镜像到一个目的端口,目的端口无法处理造成丢包


标签: CiscoCisco端口镜像网络旁路监控

电脑软硬件教程网 Copyright © 2016-2030 www.computer26.com. Some Rights Reserved.