erspan — Cisco ERSPAN Type II (0x88be) & III (0x22eb) Mirrors
- Default Port / Protocol
- IP Proto 47 (GRE 0x88be v2 / 0x22eb v3)
- Host Endpoint Rule
- Dual-Stack IPv4/IPv6
- Wireshark Display Filter
- erspan
- Standards & Specs
- IETF draft-foschiano-erspan, RFC 2784
What It Does on the Wire
Ship mirrored switch traffic across Layer 3 to Zeek or Suricata: erspan wraps GRE 0x88be (v2) or hardware-timestamped 0x22eb (v3) headers complete with sessionid, vid, and ingress/egress direction.
Encapsulated Remote SPAN (erspan, IP Protocol 47 GRE) transports mirrored switch and virtual-machine Ethernet traffic across Layer 3 IPv4 or IPv6 networks to NDR sensors (Suricata, Zeek, Corelight, ExtraHop, Darktrace) and packet brokers. ERSPAN Type II (v2) uses GRE Protocol Type 0x88be with an 8-byte metadata header carrying 10-bit sessionid, 12-bit mirrored vid, cos, and index; ERSPAN Type III (v3) uses GRE Protocol Type 0x22eb with a 12-byte header adding sub-microsecond hardware timestamp and ingress/egress direction.
FrameAssembly sets the GRE Sequence Number bit (S=1), switches the GRE Protocol EtherType automatically between 0x88be (v2) and 0x22eb (v3), and packs the exact bitfields plus an inner mirrored Ethernet frame so NDR decapsulators dissect every header cleanly.
Suricata, Zeek & NDR Sensor ERSPAN Decapsulation Testing
Verify security sensors strip outer IP + GRE (0x88be / 0x22eb) + ERSPAN Type II/III headers and preserve mirrored vid, sessionid, and direction metadata.
Nexus / Catalyst / VMware vDS ERSPAN Collector Firewall Audits
Test data-center firewall policies allowing unidirectional IP Protocol 47 ERSPAN feeds from leaf switches or ESXi hosts into out-of-band monitoring enclaves.
Packet Broker Session-ID Routing & Hardware Timestamp Validation
Emit multi-session ERSPAN Type III (v3) streams (sessionid 10, sessionid 20) with deterministic greseq and timestamp increments.
RFC Wire Header Layout (erspan)
Select any 32-bit wire word or field slice below to inspect which .frasm modifiers control those octets and what defaults the compiler writes.
Wireshark automatically strips outer IP -> GRE (0x88be Type II / 0x22eb Type III) -> ERSPAN metadata (Session ID, VLAN, Direction, Timestamp) to dissect the mirrored Ethernet frame.
Minimal Quickstart (erspan_quickstart.frasm)
Select Preview Packets to compile in-browser and inspect timestamps + wire byte lengths, or open directly in the Playground.
host leaf_sw { ip 10.20.0.11 }
host zeek_tap { ip 10.99.0.50 }
compile {
leaf_sw -> zeek_tap erspan v3 sessionid 10 vid 120 cos 5 greseq 1 timestamp 50000 direction 0
}Handled Automatically on the Wire
- Encapsulates inside IP Protocol
47(GRE withS=132-bitgreseq) using GRE Protocol0x88befor Type II (v2, default) or0x22ebfor Type III (v3). - Bit-packs Version (
0x1for Type II,0x2for Type III wire format), 12-bitvid, 3-bitcos, 10-bitsessionid, portindex, and Type III 32-bittimestamp+direction. - Includes a well-formed inner mirrored Ethernet frame (or custom
payload/hexpayloadbytes) after the ERSPAN header so Wiresharkerspannever flags truncated capture errors.
Leaf Switch Bidirectional ERSPAN Type II & Type III Feed to NDR Collector
Streams an ERSPAN Type II (0x88be) ingress capture from Session 10 and a hardware-timestamped ERSPAN Type III (0x22eb) ingress/egress pair (direction 0 -> direction 1) from Session 20.
host tor_leaf_01 { ip 172.18.1.10 mac 00:1c:73:10:00:01 }
host ndr_sensor { ip 172.18.99.20 mac 00:50:56:99:00:20 }
compile {
// 1. ERSPAN Type II (GRE 0x88be) mirroring VLAN 100 port index 48
tor_leaf_01 -> ndr_sensor erspan v2 sessionid 10 vid 100 cos 0 greseq 101 index 48 payload "mirrored-vlan100-ingress" wait 1ms
// 2. ERSPAN Type III (GRE 0x22eb) ingress frame (direction 0) + egress reply (direction 1)
tor_leaf_01 -> ndr_sensor erspan v3 sessionid 20 vid 200 cos 5 greseq 1 timestamp 100000 index 12 direction 0 payload "mirrored-rx-pdu" wait 250us
tor_leaf_01 -> ndr_sensor erspan v3 sessionid 20 vid 200 cos 5 greseq 2 timestamp 100250 index 12 direction 1 payload "mirrored-tx-pdu"
}# 1. Eyeball relative timestamps, ports & wire lengths in your terminal
frameassembly show erspan_ndr_mirror.frasm
# 2. Compile .frasm -> classic .pcap, nanosecond .pcapng, or pipe via '-'
frameassembly erspan_ndr_mirror.frasm erspan_ndr_mirror.pcap
frameassembly erspan_ndr_mirror.frasm erspan_ndr_mirror.pcapng
# 3. Round-trip .pcap <-> .frasm whenever you want to scrub or tweak an existing capture
frameassembly reverse erspan_ndr_mirror.pcap erspan_ndr_mirror_edited.frasm
# 4. Verify dissected protocol fields in tshark
tshark -r erspan_ndr_mirror.pcap -Y "erspan"All erspan Keywords & Header Options
Every sub-keyword and header option is lowercase [a-z0-9]+ with zero underscores — mix and match them in any order after erspan:
src_host -> dst_host erspan [v2 | v3 | version <2|3>] [sessionid <0..1023>] [vid <0..4095>] [cos <0..7>] [greseq <number>] [index <number>] [timestamp <number>] [direction <0|1>]| Keyword / Option | Accepted Value | Default | Effect on Packet |
|---|---|---|---|
| v2 | v3 | version <2|3> | ERSPAN version (Type II = 2, Type III = 3) | v2 (Type II, GRE 0x88be) | Selects 8-byte ERSPAN Type II (0x88be) or 12-byte hardware-timestamped ERSPAN Type III (0x22eb). |
| sessionid <0..1023> | 10-bit ERSPAN Session ID (0..1023) | 1 | Writes the 10-bit ERSPAN Session ID used by packet brokers and switches to separate mirror sessions. |
| vid <0..4095> | 12-bit mirrored VLAN ID (0..4095) | 1 | Records the original 802.1Q VLAN ID of the mirrored frame inside the ERSPAN metadata header. |
| cos <0..7> | 3-bit mirrored Class of Service (0..7) | 0 | Records the original 802.1p CoS priority bits inside the ERSPAN metadata header. |
| greseq <number> | 32-bit GRE Sequence Number | 1 | Writes the 32-bit GRE sequence counter ahead of the ERSPAN header to detect dropped mirror packets. |
| index <number> | 20-bit switch port index | 1 | Identifies the source/destination physical switch port index in the ERSPAN header. |
| timestamp <number> | 32-bit ASIC timestamp (Type III) | 0 | Writes the 32-bit lower timestamp word in ERSPAN Type III (v3) headers (100us / 1ns granularity). |
| direction <0|1> | 1-bit mirror direction (0 = Ingress, 1 = Egress) | 0 (Ingress) | Sets the T / Direction bit in ERSPAN (0 incoming to port, 1 outgoing from port). |
Cross-Layer Wrappers Valid with erspan
802.1Q VLAN / QinQ / MPLS tags, IPv4/IPv6 QoS & TTL fields, wait gaps, and transport overrides allowed on this protocol
11 options
Cross-Layer Wrappers Valid with erspan
802.1Q VLAN / QinQ / MPLS tags, IPv4/IPv6 QoS & TTL fields, wait gaps, and transport overrides allowed on this protocol
| Option | Range / Format | Default | Effect on Packet |
|---|---|---|---|
| wait <number><ns|us|ms|s|m> | Time gap (ns, us, ms, s, m) | 10ms | Advances the packet timestamp clock after sending this packet and before the next packet (wait 0ns sends back-to-back). |
| comment "<text>" | Quoted UTF-8 annotation | Omitted | Attaches an Enhanced Packet Block opt_comment annotation when compiling to .pcapng (Wireshark pkt_comment filter). |
| payload "<text>" | hexpayload "<hex>" | Quoted text or hex bytes (choose one) | Omitted | Appends or overrides raw payload bytes ("deadbeef", "de:ad:be:ef", or "\x01\x02") and updates packet lengths and checksums. |
| srcmac <mac> | dstmac <mac> | ethertype <0..65535> | Colon/hyphen/Cisco MAC · EtherType 0..65535 (e.g. 0x0800) | Host MAC / RFC multicast MAC / auto EtherType | Overrides the 14-byte Ethernet II source MAC, destination MAC, or standalone Layer 2 16-bit EtherType. |
| fcs | badfcs | Ethernet CRC-32 trailer flags (choose one) | Omitted | fcs appends a valid IEEE 802.3 4-byte CRC-32 Frame Check Sequence trailer; badfcs XOR-corrupts the CRC-32 for NIC/tap negative tests. |
| vlan <0..4095> [pcp <0..7>] [dei <0|1>] | VLAN ID 0..4095, PCP 0..7, DEI 0..1 | Untagged | Wraps the packet in an IEEE 802.1Q VLAN tag (0x8100) with optional 802.1p QoS priority. |
| qinq <0..4095> [innervlan <0..4095>] | Outer S-VLAN 0..4095, Inner C-VLAN 0..4095 | Untagged (innervlan 1 when qinq is set) | Double-tags the packet with outer IEEE 802.1ad S-Tag (0x88a8) plus inner IEEE 802.1Q C-Tag (0x8100). |
| mpls <0..1048575> [label <0..1048575>] [exp|tc <0..7>] [bos <0|1>] [mplsttl <0..255>] | Repeatable label stack (0..1048575, exp/tc 0..7, bos 0..1, ttl 0..255) | Unlabeled (auto bos=0 on outer labels, bos=1 on bottom) | Prepends one or more 32-bit MPLS label shims (0x8847, e.g. mpls 16000 mpls 24010) ahead of Layer 2 EoMPLS or Layer 3 payloads. |
| ttl <0..255> [dscp <0..63>] [ecn <0..3>] | TTL/Hop Limit 0..255, DSCP 0..63, ECN 0..3 | ttl 64, dscp 0, ecn 0 | Sets IPv4 TTL or IPv6 Hop Limit plus DiffServ (DSCP) and ECN QoS markings. |
| ipid <0..65535> [df] [mf] [fragoffset <0..8191>] [routeralert] [badipchecksum] | IPv4 ID, DF/MF flags, offset 0..8191, Router Alert & checksum fault | ipid 1, flags 0, fragoffset 0, valid RFC 1071 checksum | Sets IPv4 Identification/fragmentation, injects RFC 2113 Router Alert (20 04 00 00), or corrupts the 16-bit IPv4 header checksum (badipchecksum). |
| flowlabel <0..1048575> | 20-bit IPv6 Flow Label (0..1048575) | 0 | Sets the 20-bit IPv6 Flow Label for ECMP routing tests (valid on IPv6 endpoint pairs only). |
Gotchas & Quick Fixes
Use vid on ERSPAN for Mirrored Metadata vs vlan for Outer Underlay Tagging
Assuming vlan 200 sets the inner ERSPAN metadata VLAN fieldleaf -> tap erspan v3 sessionid 10 vid 200 vlan 99vid 200 sets the mirrored VLAN ID inside the ERSPAN header, whereas vlan 99 wraps the outer delivery Ethernet frame in an 802.1Q underlay tag.
timestamp Applies to ERSPAN Type III (v3)
leaf -> tap erspan v2 timestamp 50000leaf -> tap erspan v3 sessionid 10 timestamp 50000ERSPAN Type II (0x88be) is a fixed 8-byte header without a 32-bit timestamp field; add v3 (0x22eb) when testing hardware timestamps.