2024年4月17日发(作者:)
如何配置交换机镜像端口
(
网文精选)
(2008-12-26 17:05:31)
如果使用交换机做为整个公司接入互联网的网关,那么,想监控整个网络的数据,需要 把交换机
的某个端口设置为镜像口, 让其他所有端口的数据都通过这个镜像口, 达到监控的 目的。
如何设置交换机的镜像端口呢?以下以现在比较通用的华为交换机为例子, 具体说明交换机 的镜像
口设置。
华为交换机设置:
1
、 在能连通交换机的机器上,点击 开始”=》运行”,输入“
cmd
”进入
dos
状态;
2
、 通过
TelNet
链接到交换机, (假设交换机
Ip
地址:
192
。
168
。
0
。
1
,可以通过
Ipconfig/all
查询交换机
IP
地址),那么输入命令行:
Telnet 192.168.0.1
输入用户名和密码。
3
、 再根据以下交换机型号,输入相应的命令,如下:
【
3026
等交换机镜像】
S2008/S2016/S2026/S2403H/S3026
等交换机支持的都是基于端口的镜像,有两种方法: 方法一
1.
配置镜像(观测)端口
[SwitchA]monitor-port e0/8
2.
配置被镜像端口
[SwitchA]port mirror Ethernet 0/1 to Ethernet 0/2
方法二
1.
可以一次性定义镜像和被镜像端口
[SwitchA]port mirror Ethernet 0/1 to Ethernet 0/2 observing-port Ethernet 0/8
举例:
交换机
2403h
:
>telnet 192.168.0.1
>username:admin
>password:admin
>sys
>monitor-port e0/8
>port mirror Ethernet 0/1 to Ethernet 0/7
则把交换机的
1
-
7
端口数据镜像到端口
【
8016
交换机端口镜像配置】
8
。
1•
假设
8016
交换机镜像端口为
E1/0/15
,被镜像端口为
E1/0/0
,设置端口
1/0/15
为端口镜 像的观测
端口。
[SwitchA] port monitor ethernet 1/0/15
2.
设置端口
1/0/0
为被镜像端口,对其输入输出数据都进行镜像。
[SwitchA] port mirroring ethernet 1/0/0 both ethernet 1/0/15
也可以通过两个不同的端口,对输
入和输出的数据分别镜像
1.
设置
E1/0/15
和
E2/0/0
为镜像(观测)端口
[SwitchA] port monitor ethernet 1/0/15
2.
设置端口
1/0/0
为被镜像端口,分别使用
E1/0/15
和
E2/0/0
对输入和输出数据进行镜像。
[SwitchA] port mirroring gigabitethernet 1/0/0 ingress ethernet 1/0/15
[SwitchA] port mirroring gigabitethernet 1/0/0 egress ethernet 2/0/0
『基于流镜像的数据流程』
基于流镜像的交换机针对某些流进行镜像, 每个连接都有两个方向的数据流, 对于交换机来 说这
两个数据流是要分开镜像的。
【
3500/3026E/3026F/3050
】
〖基于三层流的镜像〗
1.
定义一条扩展访问控制列表
[SwitchA]acl num 100
2.
定义一条规则报文源地址为
1.1.1.1/32
去往所有目的地址
[SwitchA-acl-adv-101]rule 0 permit ip source 1.1.1.1 0 destination any
[SwitchA-acl-adv-101]rule 1 permit ip source any destination 1.1.1.1 0
4.
将符合上述
ACL
规则的报文镜像到
E0/8
端口
[SwitchA]mirrored-to ip-group 100 interface e0/8
〖基于二层流的镜像〗
1.
定义一个
ACL
[SwitchA]acl num 200
2.
定义一个规则从
E0/1
发送至其它所有端口的数据包
[SwitchA]rule 0 permit ingress interface Ethernet0/1 egress interface Ethernet0/2
3.
定义一个规则从其它所有端口到
E0/1
端口的数据包
[SwitchA]rule 1 permit ingress interface Ethernet0/2 egress interface Ethernet0/1
4.
将符合上述
ACL
的数据包镜像到
E0/8
[SwitchA]mirrored-to link-group 200 interface e0/8
【
5516/6506/6503/6506R
】 目前该三款产品支持对入端口流量进行镜像
1.
定义镜像端口
[SwitchA]monitor-port Ethernet 3/0/2
2.
定义被镜像端口
[SwitchA]mirroring-port Ethernet 3/0/1 inbound
【补充说明】
1.
镜像一般都可以实现高速率端口镜像低速率端口, 例如
1000M
端口可以镜像 反之
则无法实现
2. 8016
支持跨单板端口镜像端口镜像配置
端口,
100M


发布评论