Skip to content
Ask AI

Mirror Configuration

[Command] show mirror

[Purpose] Show configuration related to mirror

[View] System view

[Use Cases]

sonic# show mirror session
+----------------+--------------------+---------------+--------+-------------+
| Session Name | Destination Port | Source Port | Type | Direction |
+================+====================+===============+========+=============+
| 1 | Ethernet1 | Ethernet2 | SPAN | BOTH |
+----------------+--------------------+---------------+--------+-------------+

[Command] mirror sessionidspan [direction {rx|tx|both}] {src-ethernet|src-vlan}port-name{dst-ethernet}port-name no mirror session*id*span

[Purpose] Create a mirror session or add port to the mirror session

[Parameter]

ParameterDescription
idmirror session ID, value range: 1-6
interface-nameInterface name, support VLAN interface and Ethernet interface
direction {rx|tx|both}Direction of traffic to be mirrored
rxthe entry direction
txthe outgoing direction
bothmirror in both directions
{src-ethernet|src-vlan}The interface on which traffic needs to be mirrored
{dst-ethernet}The destination interface for mirrored traffic

[View] System configuration view

[Use Cases]

sonic# configure
sonic(config)# mirror session 1 span direction both src-ethernet 2 dst-ethernet 3

[Command] mirror sessioniderspan [direction {rx|tx|both}] {src-ethernet}port-namegre-src-ipA.B.C.D/A::Bgre-dst-ipA.B.C.D/A::B**[gre-vrfvrf-name]** no mirror sessioniderspan

[Purpose] Create a remote mirroring session and add the source and destination addresses for GRE encapsulation

[Parameter]

ParameterDescription
idMirror session ID, valid range: 1-6
direction {rx|tx|both}Traffic direction to be mirrored.
rxInbound direction.
txOutbound direction.
{src-ethernet}Interface to be mirrored.
gre-src-ipSource IP for GRE encapsulation
gre-dst-ipDestination IP for GRE encapsulation
vrf-nameVRF for GRE encapsulation, with the default VRF set to “default”

[View] System view

[Usage Scenario] ERSPAN is a Layer 3 remote mirroring technology that duplicates packets from specified ports. It sends the duplicated packets to a remote data monitoring device through a GRE tunnel, allowing users to analyze these packets using the monitoring device for network monitoring and troubleshooting.

[Notes] To configure encapsulation parameters for Layer 3 remote mirroring, you only need to specify the mirror source and destination port on the source device. Additionally, all devices must have a unicast routing protocol configured, ensuring a seamless Layer 3 network between the devices.It should be noted that ERSPAN needs to be configured after the destination IP actually takes effect. For example, if the destination IP corresponds to a static ARP, then the static ARP needs to be configured first before configuring the ERSPAN function.

[Use Cases]

sonic# configure
sonic(config)# mirror session 1 erspan direction rx src-ethernet 3 gre-src-ip 10.1.1.1 gre-dst-ip 30.1.1.2