Configuring port mirroring for Cisco Access and Distribution switches

You can configure a SPAN session for Cisco Access and Distribution switches (for example, Cisco Catalyst™ 2960 and Cisco Catalyst 3850) using the switch command line interface. To do this, access the target switch via Ethernet or console port and open the switch management functions. In configuration mode, create a new monitoring session, select a range of source interfaces to mirror and analyze traffic, set the destination interface and save the configuration.

For more information about configuring port mirroring for Cisco Access and Distribution switches, refer to Cisco equipment documentation.

To configure port mirroring for Cisco Access and Distribution switches:

  1. From the privileged EXEC mode, enter the global configuration mode using the following command:

    conf t /

  2. To view the existing monitor sessions, enter the following command:

    show monitor session all /

  3. If necessary, delete the existing monitor session:

    no monitor session <session number> /

    where <session number> is the number of the monitor session to be deleted. You can specify a value from 1 to 66. You can use the following keywords instead of the session number:

    • all – to delete all monitor sessions
    • local – to delete local monitor sessions
    • remote – to delete remote monitoring sessions
  4. Specify the source port numbers:

    monitor session <session number> source interface <source port>/<VLAN ID> - <source port>/<VLAN ID> /

    where:

    • <session number> – monitor session number
    • <source port> – source port number
    • <VLAN ID> – VLAN identifier
  5. Specify the destination port numbers:

    monitor session <session number> destination interface <destination port> / <destination port> encapsulation replicate /

    where:

    • <session number> – monitor session number
    • <destination port> – number of the destination port
  6. Return to the privileged EXEC mode using the following command:

    end /

  7. To check the monitor session configuration, enter the following command:

    show monitor /

  8. To activate SPAN settings after rebooting the switch, save the monitor session configuration to a configuration file:

    copy running-config startup-config /

Page top