Configuring Port Mirroring

Information About Port Mirroring

You can copy the packets received or sent on a specified port to a mirroring destination port. This is called port mirroring. Normally, the destination port is connected to the data detection device. You can analyze the mirrored packets and troubleshoot faults.

A switch supports one-to-one and many-to-one mirroring. Many-to-one mirroring supports multiple mirroring sources but only one destination port.


Note

A port configured as a mirroring destination port cannot be used as a normal service port.


How to Configure Port Mirroring

The following task provides information about Configuring Port Mirroring:

Configuring Port Mirroring

To configure port mirroring on a device, perform this procedure.

Procedure

  Command or Action Purpose
Step 1

enable

Example:

Device> enable 

Enables privileged EXEC mode.

Enter your password, if prompted.

Step 2

configure terminal

Example:

Device#configure terminal 

Enters global configuration mode.

Step 3

mirror source-interface { ethernet slot/port | cpu | GPON slot/port } { ingress | egress | both }

Example:

Device(config)#mirror source-interface ethernet1/1 both 

Configures the mirrored source, which is the port from which the packets are copied. You can configure multiple mirrored sources.

Step 4

mirror destination-interface { ethernet slot/port | gpon slot/port }

Example:

Device(config)#mirror destination-interface ethernet2/1 

Configures the destination port for mirroring, which is the port to which the packets are copied. You can specify only one mirroring destination port.

Step 5

show mirror

Example:

Device(config)#show mirror

(Optional) Displays the mirroring groups.

Configuration Example for Port Mirroring

The following example shows how you can configure mirroring to copy packets from a CPU, e1/1, e1/2 ports to port e1/4:

Device#configure terminal
Device(config)#mirror source-interface cpu both
Device(config)#mirror source-interface ethernet 1/1 both
Device(config)#mirror source-interface ethernet 1/2 both
Device(config)#mirror destination-interface ethernet 1/4
Device(config)#show mirror
Information about mirror port(s)
The monitor port            : e1/4
The mirrored egress ports   : cpu,e1/1-e1/2.
The mirrored ingress ports  : cpu,e1/1-e1/2.

The packet of CPU, e1/1, e1/2 can be mirrored to port e1/4.