The Cisco NX-OS system
supports the Encapsulated Remote Switching Port Analyser (ERSPAN) feature on both source and destination ports. ERSPAN transports mirrored traffic over an IP network. The traffic is encapsulated at the source router and is transferred across the network. The packet is decapsulated at the destination router and then sent to the destination interface.
ERSPAN consists of an ERSPAN source session, routable ERSPAN generic routing encapsulation (GRE)-encapsulated traffic, and an ERSPAN destination session. You separately configure ERSPAN source sessions and destination sessions on different switches.
An ERSPAN source session is defined by the following:
A session ID.
A list of source ports, source VLANs, or source VSANs to be monitored by the session.
An ERSPAN flow ID.
Optional attributes related to the GRE envelope such as IP TOS and TTL.
Destination IP address.
Virtual Routing and Forwarding tables.
ERSPAN source sessions do not copy ERSPAN GRE-encapsulated traffic from source ports. Each ERSPAN source session can have ports, VLANs, or VSANs as sources. However, there are some limitations. For information, see Guidelines and Limitations for ERSPAN.
The following figure shows an example ERSPAN configuration.
Figure 1. ERSPAN Configuration
Monitored Traffic
By default, ERSPAN monitors all traffic, including multicast and bridge protocol data unit (BPDU) frames.
The direction of the traffic that ERSPAN monitors depends on the source, as follows:
For a source port, the ERSPAN can monitor ingress, egress, or both ingress and egress traffic.
For a source VLAN or source VSAN, the ERSPAN can monitor only ingress traffic.
ERSPAN Sources
The interfaces from which traffic can be monitored are called ERSPAN sources. Sources designate the traffic to monitor and whether to copy ingress, egress, or both directions of traffic. ERSPAN sources include the following:
Ethernet ports and port channels.
VLANs—When a VLAN is specified as an ERSPAN source, all supported interfaces in the VLAN are ERSPAN sources.
ERSPAN source ports have the following characteristics:
A port configured as a source port cannot also be configured as a destination port.
ERSPAN does not monitor any packets that are generated by the supervisor, regardless of their source.
Truncated ERSPAN
Truncated ERSPAN can be used to reduce the amount of fabric or network bandwidth used in sending ERSPAN packets.
The default is no truncation so switches or routers receiving large ERSPAN packets might drop these oversized packets.
Note
Do not enable the truncated ERSPAN feature if the destination ERSPAN router is a Cisco Catalyst 6000 Series switch because the Cisco Catalyst 6000 Series switch drops these truncated packets.
High Availability
The ERSPAN feature supports stateless and stateful restarts. After a reboot or supervisor switchover, the running configuration is applied.
Licensing Requirements for ERSPAN
The following table shows the licensing requirements for this feature:
•You must first configure the Ethernet interfaces for ports on each device to support the desired ERSPAN configuration. For more information, see the Interfaces configuration guide for your platform.
Guidelines and Limitations for ERSPAN
ERSPAN has the following guidelines and limitations:
Only ERSPAN source sessions are supported. Destination sessions are not supported.
A maximum of 16 active sessions are supported. They can be all ERSPAN sessions or a mixture of ERSPAN and SPAN sessions.
The maximum number of ports for each ERSPAN session is 128.
The maximum number of VLANs per session is 32.
You can have source ports, source VLANs, and source VSANs in one ERSPAN session.
ERSPAN can monitor ingress, egress, or both ingress and egress traffic on a source port and only ingress traffic on source VLANs or source VSANs as long as the VLAN is not mapped to a VSAN. ERSPAN cannot monitor egress traffic on source VLANs and VSANs.
Source ports and source VLANs can be in the same ERSPAN session.
ERSPAN traffic can exit the switch through a Layer 2 interface, Layer 3 interface, port channel, or FabricPath core port.
A destination IP address of a remote switch cannot be reached through a virtual Ethernet port or FEX port. This functionality is not supported.
ERSPAN traffic is not load balanced if the reachability to a destination IP address is a Layer 3 ECMP or a port channel. In the case of ECMP, the ERSPAN traffic is sent to only one next-hop router or one member of the port channel.
ERSPAN supports Fast Ethernet, Gigabit Ethernet, TenGigabit Ethernet, and port channel interfaces as source ports for a source session.
When a session is configured through the ERSPAN configuration commands, the session ID and the session type cannot be changed. In order to change them, you must first use the no version of the configuration command to remove the session and then reconfigure the session.
ERSPAN traffic might compete with regular data traffic.
ERSPAN traffic is assigned to the QoS class-default system class (qos-group 0).
To ensure that data traffic is prioritized over ERSPAN traffic, you can create a QoS system class with prioritization above the class-default system class on the ERSPAN destination port.
On Layer 3 networks, ERSPAN traffic can be marked with a the desired Differentiated Services Code Point (DSCP) value using the ip dscp command. By default, ERSPAN traffic is marked with a DSCP value of 0.
The rate limit command is not supported.
Default Settings
The following table lists the default settings for ERSPAN parameters.
Table 1 Default ERSPAN Parameters
Parameters
Default
ERSPAN sessions
Created in the shut state.
Configuring ERSPAN
Configuring an ERSPAN Source Session
The ERSPAN source session defines the session configuration parameters and the ports or VLANs to be monitored. This section describes how to configure an ERSPAN source session.
switch(config)# monitor session 1 type erspan-source
switch(config-erspan-src)#
Defines an ERSPAN source session using the session ID and the session type, and places the command in ERSPAN monitor source session configuration mode.
The span-session-number argument range is from 1 to 1024. The same session number cannot be used more than once.
The session IDs for source sessions are in the same global ID space, so each session ID is globally unique for both session types.
The session ID (configured by the span-session-number argument) and the session type (configured by the erspan-source keyword) cannot be changed once entered. To change session ID or session type, use the no version of the command to remove the session and then recreate the session through the command with a new session ID or a new session type.
Step 3
descriptionerspan_session_description
Example:
switch(config-erspan-src)# description source1
(Optional)
Describes the ERSPAN source session.
The erspan_session_description argument can be up to 240 characters and cannot contain special characters or spaces.
Step 4
source interface { ethernetslot/chassis number | portchannelnumber }
Example:
switch(config-erspan-src)# source interface eth 1/1
Associates the ERSPAN source session number with the source ports (1-255).
Step 5
source vlannumber
Example:
switch(config-erspan-src)# source vlan 1
Associates the ERSPAN source session number with the VLANs (1-4096).
Step 6
source vsannumber
Example:
switch(config-erspan-src)# source vsan 1
Specifies the VSAN ID number. The range is 1 to 4093.
Step 7
destination ipip-address
Example:
switch(config-erspan-src)# destination ip 192.0.2.2
Configures the destination IP address in the ERSPAN session. Only one destination IP address is supported per ERSPAN source session.
Step 8
erspan-idflow-id
Example:
switch(config-erspan-src)# erspan-id 5
Configures the flow ID to identify the ERSPAN flow. The range is from 1 to 1023.
Step 9
vrf {vrf-name | default }
Example:
switch(config-erspan-src)# vrf default
Configures the VRF to use instead of the global routing table. You can use a VRF that you have specifically configured or the default VRF.
Step 10
ip ttlttl-number
Example:
switch(config-erspan-src)# ip ttl 5
(Optional)
Configures the IP time-to-live (TTL) value of the packets in the ERSPAN traffic. Valid values are from 1 to 255. The default value is 255.
Step 11
ip dscpdscp_value
Example:
switch(config-erspan-src)# ip dscp 42
(Optional)
Configures the IP Differentiated Services Code Point (DSCP) value of the packets in the ERSPAN traffic. Valid values are from 0 to 63. The default value is 0.
Step 12
no shut
Example:
switch(config-erspan-src)# no shut
Enables the ERSPAN source session. By default, the session is created in the shut state.
switch(config)# monitor session 1 type
erspan-source
switch(config-erspan-src)#
Defines an ERSPAN source session using the session ID and the session type, and places the command in ERSPAN monitor source session configuration mode.
The span-session-number argument range is from 1 to 1024. The same session number cannot be used more than once.
The session IDs for source sessions are in the same global ID space, so each session ID is globally unique for both session types.
The session ID (configured by the span-session number argument) and the session type (configured by the erspan-source keyword) cannot be changed once entered. To change session ID or session type, use the no version of the command to remove the session and then re-create the session through the command with a new session ID or a new session type.
Step 4
mtumtu-value
Example:
switch(config-erspan-src)# mtu 64
Defines the maximum transmission unit (MTU) truncation size for ERSPAN packets. Valid values are from 64 to 1518.
The default is no truncation enabled.
Step 5
exit
Example:
switch(config-mon-erspan-src)# exit
Updates the configuration and exits ERSPAN source session configuration mode.
Saves the change persistently through reboots and restarts by copying the running configuration to the startup configuration.
Shutting Down or Activating an ERSPAN Session
You can shut down ERSPAN sessions to discontinue the copying of packets from sources to destinations. Because only a specific number of ERSPAN sessions can be running simultaneously, you can shut down a session in order to free hardware resources to enable another session. By default, ERSPAN sessions are created in the shut state.
You can enable ERSPAN sessions to activate the copying of packets from sources to destinations. To enable an ERSPAN session that is already enabled but operationally down, you must first shut it down and then enable it. You can shut down and enable the ERSPAN session states with either a global or monitor configuration mode command.
Procedure
Command or Action
Purpose
Step 1
configuration terminal
Example:
switch# configuration terminal
switch(config)#
Enters global configuration mode.
Step 2
monitor session {session-range | all} shut
Example:
switch(config)# monitor session 3 shut
Shuts down the specified ERSPAN sessions. The session range is from 1 to 48. By default, sessions are created in the shut state. Only two sessions can be running at a time.
Step 3
no monitor session {session-range | all} shut
Example:
switch(config)# no monitor session 3 shut
Resumes (enables) the specified ERSPAN sessions. The session range is from 1 to 48. By default, sessions are created in the shut state. Only two sessions can be running at a time.
Note
If a monitor session is enabled but its operational status is down, then to enable the session, you must first specify the monitor session shut command followed by the no monitor session shut command.
Step 4
monitor sessionsession-numbertype erspan-source
Example:
switch(config)# monitor session 3 type erspan-source
switch(config-erspan-src)#
Enters the monitor configuration mode for the ERSPAN source type. The new session configuration is added to the existing session configuration.