Network Assurance · Topic 4 of 7

SPAN, RSPAN and ERSPAN

Configure SPAN, RSPAN and ERSPAN to mirror traffic to an analyser: sources and destinations, the RSPAN VLAN, GRE for ERSPAN, and verification.

  • 6 min
  • Includes a diagram
In a nutshell
  • SPAN copies traffic on one switch. RSPAN carries the copy across a Layer 2 network. ERSPAN carries it across a Layer 3 network.
  • A SPAN source can be a port or a VLAN, with the direction rx, tx or both.
  • monitor session N source and monitor session N destination configure SPAN.

What it is

Port mirroring copies traffic from one place so that a tool can analyse it without disturbing the original flow.

A switch forwards frames only to the port that needs them, so a packet analyser on a spare port sees nothing useful. Mirroring solves this by sending a copy of chosen traffic to the port where the analyser sits. Cisco has three forms, named SPAN, RSPAN and ERSPAN, and they differ in how far the copy can travel.

Source portuser trafficcopySwitchSPAN sessionmirrored framesDestination portanalyser attached

How it works

The three forms use the same idea, with a bigger reach each time, and the examples use IOS XE.

Comparing the three forms

FormNameReachCarried by
SPANSwitched Port AnalyzerSame switchNothing, local copy
RSPANRemote SPANOther switches in the same Layer 2 domainA dedicated VLAN across trunks
ERSPANEncapsulated Remote SPANAnywhere with IP reachabilityGRE tunnel over IP

Local SPAN

A SPAN session has one or more sources and one destination. A source can be a port or a VLAN. You choose which direction to copy: received traffic (rx), sent traffic (tx) or both.

Switch(config)# monitor session 1 source interface GigabitEthernet1/0/1 both
Switch(config)# monitor session 1 destination interface GigabitEthernet1/0/24

Here traffic in both directions of port 1 is copied to port 24, where the analyser is attached. You can use a VLAN as the source instead:

Switch(config)# monitor session 2 source vlan 10 rx

Some rules to know:

  • A destination port normally stops forwarding regular traffic, and is used only for monitoring.
  • A port cannot be both a source and a destination in the same session.
  • A destination port belongs to one session.
  • The number of sessions is limited by the platform.

If the sources carry more traffic than the destination can send, the extra copies are dropped. The original traffic is not affected, but the analyser may miss frames.

RSPAN

A user PC on port Gi1/0/1 of Switch1 is the SPAN source. Mirrored frames travel in RSPAN VLAN 900 across a trunk to Switch2, which sends them out Gi1/0/24 to a packet analyser. RSPAN lets the analyser sit on a different switch from the source. It uses a special VLAN that carries the mirrored traffic across trunks.

Switch(config)# vlan 900
Switch(config-vlan)# remote-span

The RSPAN VLAN must exist on every switch in the path, and it must be allowed on the trunks between them. Create it with remote-span on each switch.

Source switch:

Switch1(config)# monitor session 1 source interface GigabitEthernet1/0/1 both
Switch1(config)# monitor session 1 destination remote vlan 900

Destination switch:

Switch2(config)# monitor session 1 source remote vlan 900
Switch2(config)# monitor session 1 destination interface GigabitEthernet1/0/24
Switch 1source portmirrored frames in VLAN 900TrunkRSPAN VLAN allowedframes arriveSwitch 2session source remote VLANsent toAnalyserdestination port

The RSPAN VLAN should carry only mirrored traffic. Do not use it for normal hosts, because mirrored frames are flooded in it.

ERSPAN

Switch1 with origin address 10.1.1.1 wraps mirrored frames in a GRE tunnel with ERSPAN ID 100 and sends them across a routed network to an analyser at 10.2.2.2. ERSPAN wraps the mirrored frames in GRE and sends them over a routed network. The source and the analyser can be in different sites. The session at the source is an ERSPAN source, and the receiving device is an ERSPAN destination.

Switch1(config)# monitor session 1 type erspan-source
Switch1(config-mon-erspan-src)# source interface GigabitEthernet1/0/1 both
Switch1(config-mon-erspan-src)# destination
Switch1(config-mon-erspan-src-dst)# erspan-id 100
Switch1(config-mon-erspan-src-dst)# ip address 10.2.2.2
Switch1(config-mon-erspan-src-dst)# origin ip address 10.1.1.1

The ip address is the destination of the GRE tunnel, and origin ip address is the source address that the device uses. The erspan-id identifies the session, and it must match at the receiver. The receiving end may be another switch or router set up as an ERSPAN destination, or a tool that understands the encapsulation.

The exact command set depends on the platform and software release. Support for ERSPAN also varies, and some Catalyst models act only as a source.

Source switchERSPAN source sessionGRE over IPRouted networkany IP pathGRE over IPAnalyserdecapsulates frames

ERSPAN adds a header, so the packets are larger. Check the path MTU, or large mirrored frames may be dropped.

Verifying

Switch# show monitor session 1
Switch# show monitor session all
Switch# show vlan remote-span

show monitor session shows the type, the sources, the destination and the direction. If a source or destination is missing, the session is not complete, and nothing is mirrored.

Typical uses

  • Capture voice or application traffic for troubleshooting.
  • Feed an intrusion detection system.
  • Send traffic to a monitoring tool at a central site with ERSPAN.

What to remember for the exam

Eight facts cover most questions on this topic.

  • SPAN copies traffic on one switch. RSPAN carries the copy across a Layer 2 network. ERSPAN carries it across a Layer 3 network.
  • A SPAN source can be a port or a VLAN, with the direction rx, tx or both.
  • monitor session N source and monitor session N destination configure SPAN.
  • RSPAN uses a dedicated VLAN created with remote-span.
  • RSPAN needs the VLAN on all switches in the path and allowed on trunks.
  • ERSPAN encapsulates mirrored traffic in GRE.
  • A SPAN destination port normally does not forward regular traffic.
  • show monitor session verifies a session.
Exam tip

Match the form to the path. Same switch is SPAN, same Layer 2 network is RSPAN, and across routers is ERSPAN.

Common mistakes

These four mistakes appear often.

Forgetting remote-span on the VLAN. The VLAN cannot carry RSPAN traffic.

Not allowing the RSPAN VLAN on the trunk. The mirrored frames never reach the other switch.

Expecting a destination port to work as a normal port. It is used for monitoring, and it normally does not forward other traffic.

Ignoring MTU with ERSPAN. The GRE header makes the frames larger.

Watch out

Do not connect a destination port to the production network by mistake, since it receives copies of other users' traffic.

Check yourself

Work through these three questions.

  • Which form of mirroring crosses a routed network?

    ERSPAN, because it wraps mirrored frames in GRE and sends them over IP.

  • What must be true of the RSPAN VLAN?

    It must be created with remote-span and allowed on every trunk in the path.

  • What directions can a SPAN source copy?

    It can copy received traffic (rx), sent traffic (tx) or both.

Topic 4 of 7 in Network Assurance

Test yourself on Network Assurance

The full Cisco CCNP 350-401 ENCOR question bank has 854 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by Cisco. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.