What Is Port Mirroring?
Port mirroring is used on a network switch or a router to send a copy of network packets seen on the specified ports (source ports) to other specified ports (destination ports). With port mirroring enables, the packets can be monitored and analyzed. Port mirroring is applied widely, for example, network engineers can use port mirroring to analyze and debug data or diagnose errors on their networks without affecting the packet processing capabilities of the network devices. And the Ministry of Culture and Public Security can collect related data from port mirroring to analyze the network behaviors, so as to ensure a healthy network environment.
How Does Port Mirroring Work?
Local and remote port mirroring are two types of port mirroring based on different working ranges of mirroring. They operate on different principles.
Local port mirroring is the most basic form of mirroring. All source ports are located on the same network device as the destination ports.
You must dedicate observing ports for mirroring use and do not configure other services on them to prevent mirrored traffic and other service traffic from affecting each other. Do not configure any member port of an Eth-Trunk as an observing port. If you must do so, ensure that the bandwidth of service traffic on this port and the bandwidth occupied by the mirrored traffic do not exceed the bandwidth limit of the port.
If the mirroring function is deployed on many ports of a device, a great deal of internal forwarding bandwidth will be occupied, which affects the forwarding of other services. Additionally, if the mirrored port bandwidth is higher than the observing port bandwidth, for example, 1000 Mbit/s on a mirrored port and 100 Mbit/s on an observing port, the observing port will fail to forward all mirrored packets in a timely manner because of insufficient bandwidth, leading to packet loss.
This configuration example was run on an X8A router with version V800R011C10SPC100.
Networking of local port mirroring:
Verify the configuration: