![](/images/new-backgrounds/1121221/12122197x1.webp)
Port Mirroring
This section describes the Port Mirroring feature, which can serve as a diagnostic tool, debugging tool, or means of fending off attacks.
Overview
Port mirroring selects network traffic from specific ports for analysis by a network analyzer, while allowing the same traffic to be switched to its destination. You can configure many switch ports as source ports and one switch port as a destination port. You can also configure how traffic is mirrored on a source port. Packets received on the source port, transmitted on a port, or both received and transmitted, can be mirrored to the destination port.
CLI Examples
The following are examples of the commands used in the Port Mirroring feature.
Example #1: Set up a Port Mirroring Session
The following command sequence enables port mirroring and specifies a source and destination ports.
console#configure console(config)#monitor session 1 mode console(config)#monitor session 1 source interface 1/g7 ?
rx | Monitor | ingress packets only. | ||
tx | Monitor | egress | packets | only. |
<cr> | Press enter to | execute | the command. |
console(config)#monitor session 1 source interface 1/g7 console(config)#monitor session 1 destination interface 1/g10 console(config)#exit
Example #2: Show the Port Mirroring Session
console#show monitor session 1
Session ID | Admin Mode | Probe | Port | Mirrored Port | Type |
1 | Enable | 1/g10 |
| 1/g7 | Rx,Tx |
Switching Configuration
49