[Cisco] – cisco 4507r 端口鏡像配置方法
Router(config)#monitor session ?
SPAN session number
Router(config)#monitor session 1 ?
destination SPAN destination interface or VLAN
filter SPAN filter VLAN
source SPAN source interface or VLAN
Router(config)#monitor session 1 de
Router(config)#monitor session 1 destination ?
interface SPAN destination interface
Router(config)#monitor session 1 destination i
Router(config)#monitor session 1 destination interface ?
FastEthernet FastEthernet IEEE 802.3
Router(config)#monitor session 1 destination interface f
Router(config)#monitor session 1 destination interface fastEthernet ?
FastEthernet interface number
Router(config)#monitor session 1 destination interface fastEthernet 0/0 ?
, Specify another range of interfaces
- Specify a range of interfaces
Router(config)#monitor session 1 s
Router(config)#monitor session 1 source ?
interface SPAN source interface
vlan SPAN source VLAN
Router(config)#monitor session 1 source in
Router(config)#monitor session 1 source interface ?
FastEthernet FastEthernet IEEE 802.3
Port-channel Ethernet Channel of interfaces
Router(config)#monitor session 1 source interface fa
Router(config)#monitor session 1 source interface fastEthernet ?
FastEthernet interface number
Router(config)#monitor session 1 source interface fastEthernet 0/0 ?
, Specify another range of interfaces
- Specify a range of interfaces
both Monitor received and transmitted traffic
rx Monitor received traffic only
tx Monitor transmitted traffic only
Router(config)#monitor session 1 source interface fastEthernet 0/0 b
Router(config)#monitor session 1 source interface fastEthernet 0/0 both ?
Router(config)#monitor session 1 source interface fastEthernet 0/0 both
Router(config)#monitor session 1 de
Router(config)#monitor session 1 destination ?
interface SPAN destination interface
Router(config)#monitor session 1 destination in
Router(config)#monitor session 1 destination interface fa
Router(config)#monitor session 1 destination interface fastEthernet ?
FastEthernet interface number
Router(config)#monitor session 1 destination interface fastEthernet 0/1
Router(config)#do sh moni sess 1
Session 1
monitor session 1 source vlan 2 – 7 監看的vlan 在L2 只能設PORT
monitor session 1 destination interface Gi1/0/23 導到哪一個PORT 監看~!!!!
Mirror Port Monitor
發生網路異常,最直接的方式就是分析異常流量的內容
簡單來說有下列步驟
1. 首先確認異常的流量地方
在好幾百個Port的地方要找出不尋常流量的Switch Port,
本身就是一個難題, 這是需要平常就花時間在紀錄每個Port的流量,
才能在緊急時比對每個port目前的流量和以前是否不一樣。
一般免費的Solution是用MRTG來做流量的記錄。
2. 進行流量管理
在確認異常Port之後,
可直接下指令將該異常 Switch Port 關閉停用,
再觀察整個網路環境是否己改善。
如果想找出異常流量的內容,就必須用網路封包分析軟體
(eg: sniffer, Ethereal 或是 Windows內建的網路分析軟體),
收集異常Port的流量內容再加以分析。
除非你能將網路封包分析軟體直接安裝到使用異常流量的主機內,
直接抓取,不然你就一定要利用Mirror Port的方式來進行。
如何設定Mirror Port:
以Cisco 2950為例
#config t
先設定要監控的是那個port
#monitor session “number” “source” interface “mod_number/port_number” both
eg: # monitor session 1 source int f0/15
再設定要把上述Port的流量全部導入另一個port
#monitor session “number” “destination” interface “mod_mnumber/port_number”
eg: #monitor session 1 destination int f0/16
最後把安裝網路封包分析軟體的電腦,接上 swithc port f0/16,
這樣就可以進行接收分析在port f0/15 中所有封包活動的內容了
===========================================
Cisco 3500系統 Mirror Port 設定範例
1. 進入主機裝有封包分析軟體的port
3500(config)# int f0/18
3500(config-if)#
2. 設定要偵測port,把流量導入
3500(config-if)#port monitor f0/21
完成
檢查是否設定完成 #sh port monitor
Monitor Port Port Being Monitored
——————— ———————
FastEthernet0/18 FastEthernet0/21
+=======================================================================================================+
以下這篇則是某技術性網站的一篇問答
主要闡述設定port mirror時,到底不同vlan有沒有關係。
其實cisco官網文件,就有說明到,不同vlan也是能設定mirror的。
http://www.cisco.com/warp/public/473/41.html#topic4
看示意圖,一目了然!
======================================================================================================
假如我的Switch 有切 4 個 vlan , 1-6 Port 一個vlan,7-12 Port 一個vlan…以此類推,我的問題是:
如果我想要設定 Port mirror 我的 Source Port 設定在第1個,Destnation Port
設定在第12 Port,這樣可行嗎,還是說 Mirror Port的來源目地要再同一個vlan呢?
(switch 是 cisco 2950)
======================================================================================================
我用 3640 + NM16ESW 剛好沒有 port 的指令.
Router#show monitor session 1
Session 1
———
Source Ports:
RX Only: None
TX Only: None
Both: Fa0/0
Source VLANs:
RX Only: None
TX Only: None
Both: None
Destination Ports: Fa0/1
Filter VLANs: None
Router#show running-config interface fastethernet0/0
Building configuration…
Current configuration : 60 bytes
!
interface FastEthernet0/0
switchport access vlan 10
end
Router#show running-config interface fastethernet0/1
Building configuration…
Current configuration : 60 bytes
!
interface FastEthernet0/1
switchport access vlan 20
end
想要了解的是設定 Mirror Port 是否有些限制或規範,
並不是想請教指令該如何下,例如必須在同一 vlan 或者是也可以跨不同的vlan 來設定來源目地的Port。
======================================================================================================
應該是 Interface 都可以監聽.
設定為 “可以用 Switch 的每個 port 的名稱” 或是 vlan.
上面就是 f0/1 和 f0/0 兩個不同 VLAN.
設為 monitor 本身放在哪個 VLAN 應該不重要了.
Switch# show monitor session 1
如何在Cisco Catalyst系列交换机上配置镜像端口
Cisco Catalyst系列交换机,IOS软件
在进行网络故障排查、网络数据流量分析的过程中,有时需要对网络节点或骨干交换机的某些端口进-行数据流量监控分析,而在交换机中设置镜像(SPAN)端口,可以对某些可疑端口进行监控,同时又不影响被监控端口的数据交换。
SPAN(Switched Port Analyzer)的作用主要是为了给某种网络分析器提供网络数据流。它既可以实现一个VLAN中若干个源端口向一个监控端口镜像数据,也可以从若干个 VLAN向一个监控端口镜像数据。SPAN 任务不会影响交换机的正常工作。当一个SPAN任务被建立后,根据交换机所处的不同的状态或操作,任务会处于激活或非激活状态,同时系统会将其记入日志。通过“show monitor session”命令可显示SPAN的当前状态。
SPAN数据流主要分为三类:
(1)输入数据流(Ingress SPAN):指被源端口接收进来,其数据副本发送至监控端口的数据流;
(2)输出数据流(Egress SPAN):指从源端口发送出去,其数据副本发送至监控端口的数据流;
(3)双向数据流(Both SPAN):即为以上两种的综合。
在配置SPAN任务时应遵循以下原则:
(1)对数据进行监控分析的设备应搭接在监控端口上;
(2)冗余链路端口只能作为SPAN任务的源端口;
(3)SPAN任务中所有的源端口的被监控方向必须一致;
(4)在设置端口为源端口时,如果没有指定数据流的监控方向,默认为双向;
(5)当SPAN任务含有多个源端口时,这些端口可以来自不同的VLAN;
(6)取消某一个SPAN任务的命令是:no monitor session任务号;
(7)取消所有SPAN任务的命令是:no monitor;
(8)SPAN任务的目的端口不能参与到生成树的距离计算中,但由于源端口的BPDU包可以被镜像,所以SPAN目的端口可以监控到来自源端口的BPDU数据包。
配置SPAN的源端口,命令格式如下:
Switch(config)#[no]monitorsession
{source(interface type/num)|{vlan vlan_ID}}[,|-|rx|tx| both]
以下例子显示如何配置源端口为FastEthernet 5/l的SPAN任务,其监控对象为双向数据流:Switch(config)# monitor session 1 source interface fastethrnet 5/l
配置SPAN的目的端口,命令格式如下:Switch(config)# [no] monitor session(session_number){destination{interface type/num}}
以下例子显示如何配置目的端口为FastEthernet 5/48的SPAN任务:Switch(config)#monitor session l destination interface fastethernet 5/48
当SPAN任务的源端口为Trunk端口时,命令格式如下:Switch(config)#[no]monitor session{filter vlan [,|-]}
以下例子是当源端口为Trunk端口时,如何配置监控其中的VLANl~VLAN5和 VLAN9:Switch(config)# monitor session 2 filter vlan 1-5,9
以下是一个综合例子,将用到前面所提到的各种命令:
监控Trunk端口FastEtheraet4/10上的双向数据流(在该端口上承载着VLANl~ VLANl005的数据流),只监控其中VLAN57中的数据流,端口
FastEthernet4/15为目的端口,具体配置方法如下:
Switch(config)# monitor session 1 source interface fastethernet 4/10
Switch(config)# monitor session 1 filter vlan 57
Switch(config)# monitor session 1 destination interface fastethernet 4/15
如果想释放该SPAN任务,输入如下命令:Switch(config)# no monitor session 1
以下语句显示如何检验SPAN任务的配置结果:Switch# show monitor session 2
在配置镜像端口(SPAN)过程中,还应考虑到数据流量过大时,设备的处理速度及端口数据缓存的大小,要尽量减少被监控数据包的丢失。