什么是交換機端口鏡像?
端口鏡像(英文名:portMirroring)把交換機一個或多個端口(VLAN)的數據鏡像到一個或多個端口的方法。端口鏡像又稱端口映射,是網絡通信協議的一種方式。
為了方便對一個或多個網絡接口的流量進行分析(如IDS產品、網絡分析儀等),可以通過配置交換機來把一個或多個端口(VLAN)的數據轉發到某一個端口來實現對網絡的監聽,是網絡通信協議的一種方式。
擴展資料:
端口鏡像的功能
監視到進出網絡的所有數據包,供安裝了監控軟件的管理服務器抓取數據,如網吧需提供此功能把數據發往公安部門審查。而企業出于信息安全、保護公司機密的需要,也迫切需要網絡中有一個端口能提供這種實時監控功能。在企業中用端口鏡像功能,可以很好的對企業內部的網絡數據進行監控管理,在網絡出現故障的時候,可以做到很好地故障定位。
參考資料來源:百度百科-端口鏡像
參考資料來源:百度百科-交換機
交換機端口鏡像配置(無廢話干貨版)
思科交換機
端口鏡像配置
①使用telnet或者ssh連接到交換機上,可以使用連接工具,也可以直接在cmd下運行。下面使用cmd下的telnet遠程連接:在開始-運行,輸入cmd,回車。在彈出框中輸入telnet ip地址,回車,輸入用戶名和密碼。
②輸入enable,回車,輸入root賬戶的密碼,進入root賬戶。
③查看交換機端口的基本情況,輸入命令show ip int bri,可以查看端口狀態,FastEthernet表示百兆以太網端口,GigabitEthernet表示千兆以太網端口。
④輸入conf t,進入配置模式。
⑤設置源鏡像口,設置1到5口為源鏡像, monitor ssion 1 source interface gigabitEthernet 1/0/1- 5 ,其中gigabitEthernet1/0/1表示千兆端口1,如果是百兆的話就換成fastEthernet,這里的gigabitEthernet1/0/1或者fastEthernet 0/1要與步驟3中查看到的端口信息一致。另外輸入命令時,打一個首字母,按兩下tab鍵,就可以把單詞自動補齊。如打個m,按兩下tab鍵就自動處理monitor。
⑥monitor ssion 1 source interface gigabitEthernet 1/0/1- 5,這條命令的-與5之間有空格的。5后面沒有參數表上both,監聽雙向數據,5后面加上rx只監聽接收數據,5后面加tx只監聽發送數據。如果只鏡像一個口的數據,直接寫某個口,如步驟7。
⑦配置目的鏡像口。 monitor ssion 1 destination interface gigabitEthernet 1/0/6 ,使端口6為目的鏡像口。注意事項同步驟4或者步驟5。
⑧查看鏡像口配置情況。輸入exit,退出設置模式。輸入命令show monitor。
⑨若鏡像口配置錯誤,則刪除鏡像口。root模式下,輸入conf t。no monitor ssion 1。
⑩鏡像口沒有配置錯誤的話,就不要使用步驟9了。使用wr保存配置即可。
華為交換機
端口鏡像配置
display interface Ethernet brief 查看端口的運行狀態和相關信息【display interface description 查看接口的描述信息(display interface brief 查看接口狀態和配置的簡要信息)】
system-view 進入視圖模式
一對一本地端口鏡像(一個監控設備監控一個端口)
obrve-port 1 interface GigabitEthernet 1/0/2 觀察口
Interface GigabitEthernet 1/0/1 鏡像口
port-mirroring to obrve-port 1 inbound/outbound/both
多對一端口本地端口鏡像(多個監控設備同時監控一個端口)
方法一:(單個配置觀察端口)
obrve-port 1 interface GigabitEthernet1/0/2 ##觀察口1
obrve-port 2 interface GigabitEthernet1/0/3 ##觀察口2
obrve-port 3 interface GigabitEthernet1/0/4 ##觀察口3
interface GigabitEthernet1/0/1或者 GigabitEthernet1/0/10 (上聯口 ) ##鏡像口port-mirroring to obrve-port 1 inbound/outbound/both
port-mirroring to obrve-port 2 inbound/outbound/both
port-mirroring to obrve-port 3 inbound/outbound/both
方法二:(批量配置觀察端口)
obrve-port 1 interface-range GigabitEthernet1/0/2 to GigabitEthernet1/0/4 ##端口2到4為觀察口
interface GigabitEthernet1/0/1或者 GigabitEthernet1/0/10 (上聯口) ##鏡像口
port-mirroring to obrve-port 1 inbound/outbound/both
一對多端口鏡像配置(一個監控設備監控多個端口)
obrve-port 1 interface GigabitEthernet1/0/4 ##觀察口
interface GigabitEthernet1/0/1 ##鏡像口1
port-mirroring to obrve-port 1 inbound/outbound/both
interface GigabitEthernet1/0/2 ##鏡像口2
port-mirroring to obrve-port 1 inbound/outbound/both
interface GigabitEthernet1/0/3 ##鏡像口3
port-mirroring to obrve-port 1 inbound/outbound/both
注:inbound、outbound可綁定的端口數量要根據設備、或者板卡的型號而定
華為交換機如何配置端口鏡像
如果我們要對交換機下面的數據流量進行抓包的話,那么就需要在交換機上配置鏡像端口,華為交換機是很多用戶都在使用的,下面是我整理的華為交換機配置端口鏡像的方法,供您參考。
華為交換機配置端口鏡像的方法
演示環境中是通過電腦的com接口連接華為交換機的
你也可以通過telnet來操作
先確認你電腦的com接口編號
然后運行超級終端工具
選擇你電腦的com接口編號
設置比特率
成功登陸交換機
在系統視圖下配置端口鏡像
先配置觀察端口
[Quidway]obrve-port 1 interface GigabitEthernet 0/0/24
然后再進入需要鏡像的端口
[Quidway]interface GigabitEthernet 0/0/23
在配置鏡像端口模式
[Quidway-GigabitEthernet0/0/23]port-mirroring to obrve-port 1 both
配置完成之后用display current 查看下配置
交換機端口鏡像命令是什么?
華為5700
[Quidway]obrve-port 1 interface GigabitEthernet 0/0/11
//設置11口為監測端口
[Quidway-GigabitEthernet0/0/2]port-mirroring to obrve-port 1 outbound
//將2口outbount方向數據鏡像到11口
H3C
端口鏡像:
建立本地鏡像組:[H3C] mirroring-group 1 local //數字”1”是組的名字
在端口視圖下設置鏡像組源端口和鏡像方向:
[H3C-GigabitEthernet1/0/1]mirroring-group 1 mirroring-port <both/inbound/outbound>
//both為雙向,inbound是端口入方向,outbound是端口出方向
在端口視圖下設置鏡像組的監測端口:
[H3C-GigabitEthernet1/0/1] mirroring-group 1 monitor-port
思科系列:
舉例:通過交換機的第2號端口監控第1端口的流量
switch(config)#monitor ssion 1 source interface g0/1
switch(config)#monitor ssion 1 destination interface g0/2
交換機的端口鏡像是什么意思
端口鏡像可以用來捕獲鏡像端口的數據流,一般用來分析網絡異常。比如B端口是A端口的鏡像,那么在B端口上通過常用的一些工具就可以獲取A端口的網絡數據包,通過捕獲的數據包就可以分析A端口是否有異常網絡流量。
中興交換機如何設置端口鏡像
14.1 2826/2826E/2618
Zte(cfg)#t mirror add port 1,16 --添加被鏡像端口
Zte(cfg)#t mirror monitorport 24 --設置監聽端口
Zte(cfg)#t mirror type ingress --設置監聽類型{ingress | egress | all}
Zte(cfg)#t mirror enable --開啟鏡像
Zte(cfg)#show mirror --查看鏡像
Zte(cfg)#t mirror delete port 1,16 --刪除被鏡像口
Zte(cfg)#t mirror disable --關閉鏡像
14.2 T16S/T16C/T32C/T64C
Port mirroring monitor-port <port number> target-port <port list>|target-profile <acl name>
注:不支持端口對端口的鏡像,只支持對整個WAN卡配置端口鏡像
14.3 T160G/T64G
ZXR10(config)#interface gei_1/1 --被鏡像口(rx)
ZXR10(config-if)#monitor ssion 1 source direction rx
ZXR10(config)interface gei_1/2 --被鏡像口(both)
ZXR10(config-if)#monitor ssion 1 source
ZXR10(config)#interface gei_3/3 --監控口
ZXR10(config-if)#monitor ssion 1 destination
ZXR10(config)#show monitor ssion 1
注:最多支持8組鏡像,每組最多支持8個被鏡像口