镜像端口网络流量

如图1所示,如果打算在PC4上安装抓包工具或流量监控软件来监控网络中的计算机上网流量,PC4只能捕获自己发送出去和接收到的数据包,PC1、PC2、PC3的上网流量由交换机直接转发到路由器的GE0/0/0端口,PC4上的抓包工具或流量监控软件是没有办法捕获这些数据包的。

为了让PC4上的抓包工具或流量监控软件能够捕获分析内网计算机访问Internet的流量,可以将交换机的Ethernet 0/0/4端口设置为监控端口,为Ethernet 0/0/5端口指定镜像端口(监控端口)。这样进出Ethernet 0/0/5端口的帧会同时转发给Ethernet 0/0/4端口。

镜像端口网络流量_流量监控


图1 镜像端口监控网络流量

由于eNSP软件中模拟的交换机不支持镜像端口功能,因此我们使用AR1220路由器替代交换机来做镜像端口实验,如图2所示。

镜像端口网络流量_html_02


图2通过AR1220路由器做镜像端口

[AR1200]observe-port interface Ethernet 0/0/3 --指定监控端口

[AR1200]interface Ethernet 0/0/4

[AR1200-Ethernet0/0/4]mirror to observe-port ?

both Assign Mirror to both inbound and outbound of an interface --出入端口的流量

inbound Assign Mirror to the inbound of an interface --进端口的流量

outbound Assign Mirror to the outbound of an interface --出端口的流量

[AR1200-Ethernet0/0/4]mirror to observe-port both --将出入端口的流量同时发送到监控端口


验证镜像端口,捕获PC4 Ethernet 0/0/1口的数据包,用PC1 ping网关192.168.0.1,可以看到捕获了PC1到网关的数据包。

注意:华为交换机只能设置一个observe-port监控端口。如果打算取消监控端口,需要先在被监视端口上取消镜像,再取消监控端口,配置命令如下。


[AR1200]interface Ethernet 0/0/4

[AR1200-Ethernet0/0/4]undo mirror both

[AR1200-Ethernet0/0/4]quit





[AR1200]undo observe-port

此文章来自于《华为认证(2021新版HCIA教材)

京东购买本书

​https://item.jd.com/13706744.html​

学习计算机网络华为网络工程师 华三网络工程师课程中有问题联系韩老师​

华为认证(2021新版HCIA教材)课程链接 https://edu.51cto.com/course/28956.html

镜像端口网络流量_html_03


韩老师招收正式学生、门徒级套餐

​https://edu.51cto.com/topic/819.html​